| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: H2 Group |
| 5 |
*/ |
| 6 |
package org.h2.bnf; |
| 7 |
|
| 8 |
import java.util.HashMap; |
| 9 |
|
| 10 |
/** |
| 11 |
* Represents a BNF rule. |
| 12 |
*/ |
| 13 |
public interface Rule { |
| 14 |
|
| 15 |
/** |
| 16 |
* Update cross references. |
| 17 |
* |
| 18 |
* @param ruleMap the reference map |
| 19 |
*/ |
| 20 |
void setLinks(HashMap<String, RuleHead> ruleMap); |
| 21 |
|
| 22 |
/** |
| 23 |
* Add the next possible token(s). If there was a match, the query in the |
| 24 |
* sentence is updated (the matched token is removed). |
| 25 |
* |
| 26 |
* @param sentence the sentence context |
| 27 |
* @return true if a full match |
| 28 |
*/ |
| 29 |
boolean autoComplete(Sentence sentence); |
| 30 |
|
| 31 |
/** |
| 32 |
* Call the visit method in the given visitor. |
| 33 |
* |
| 34 |
* @param visitor the visitor |
| 35 |
*/ |
| 36 |
void accept(BnfVisitor visitor); |
| 37 |
|
| 38 |
} |