Package org.opencypher.tools.g4tree
Interface GrammarItem
-
- All Known Subinterfaces:
Element
- All Known Implementing Classes:
BnfSymbolLiteral,CharacterLiteral,ElementWithCardinality,EOFreference,ExclusionCharacterSet,FreeTextItem,GrammarName,GrammarTop,Group,InAlternative,InAlternatives,InHeader,InLiteral,InOptional,ListedCharacterSet,NamedCharacterSet,OneOrMore,Rule,RuleId,RuleList,ZeroOrMore
public interface GrammarIteman item in a grammar.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classGrammarItem.ItemType
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<GrammarItem>getChildren()get the child items as a list.StringgetStructure(String indent)Reserialise showing the internal structure of the grammar.GrammarItem.ItemTypegetType()what type, in terms of how to process its conversion to main grammarbooleanisKeywordPart()Could this be part or all of a keyword ? Is either a letter or all of its parts are lettersbooleanisPlural()are there more than one of these items.GrammarItemreachThrough()if this item is a wrapper round a single item, get that one.
-
-
-
Field Detail
-
INDENT
static final String INDENT
default indentation- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
GrammarItem.ItemType getType()
what type, in terms of how to process its conversion to main grammar- Returns:
-
getChildren
List<GrammarItem> getChildren()
get the child items as a list. Terminals will return an empty list, non-lists will return a list of one.- Returns:
-
isPlural
boolean isPlural()
are there more than one of these items. Some serialisations will require brackets of some kind if there are- Returns:
- true if there are multiple of these items.
-
reachThrough
GrammarItem reachThrough()
if this item is a wrapper round a single item, get that one. A wrapper may affect cardinality, optionality etc.- Returns:
- the wrapped item, or this item itself it if isn't wrapper.
-
isKeywordPart
boolean isKeywordPart()
Could this be part or all of a keyword ? Is either a letter or all of its parts are letters- Returns:
- true iff this could be part of a keyword
-
getStructure
String getStructure(String indent)
Reserialise showing the internal structure of the grammar. This is based on the rules of the "orignal BNF" g4, and may not correspond to how the user thinks of the structure- Parameters:
indent- how much to indent each level of the structure- Returns:
- a String showing the internals and values in the grammar
-
-