Interface CBParseContextType
- All Superinterfaces:
AutoCloseable
The parsing context.
-
Method Summary
Modifier and TypeMethodDescription<T extends com.io7m.jsx.SExpressionType>
TcheckExpressionIs(com.io7m.jsx.SExpressionType expression, Optional<UUID> specSection, Class<T> clazz) Check that the expression is of the given type.com.io7m.jsx.SExpressionType.SSymbolcheckExpressionIsKeyword(com.io7m.jsx.SExpressionType expression, Optional<UUID> specSection, String name, String errorCode) Check that the expression is a keyword.voidclose()intfailed(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, Exception exception, String errorCode) Parsing failed.failed(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode) Parsing failed.failed(com.io7m.jsx.SExpressionType expression, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode) Parsing failed.failed(com.io7m.jsx.SExpressionType expression, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode, Exception e) Parsing failed.openExpectingOneOf(String kind, List<String> shapes) Open a new parsing context expecting one of the given shapes.voidsetLanguageVersion(int major, int minor) Set the expected language version.
-
Method Details
-
openExpectingOneOf
Open a new parsing context expecting one of the given shapes.- Parameters:
kind- The kindshapes- The shapes- Returns:
- A new parsing context
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
CBParseFailedException
-
setLanguageVersion
void setLanguageVersion(int major, int minor) Set the expected language version.- Parameters:
major- The major versionminor- The minor version
-
checkExpressionIs
<T extends com.io7m.jsx.SExpressionType> T checkExpressionIs(com.io7m.jsx.SExpressionType expression, Optional<UUID> specSection, Class<T> clazz) throws CBParseFailedException Check that the expression is of the given type.- Type Parameters:
T- The expression type- Parameters:
expression- The expressionspecSection- The quoted spec sectionclazz- The class- Returns:
- expression
- Throws:
CBParseFailedException- On errors
-
checkExpressionIsKeyword
com.io7m.jsx.SExpressionType.SSymbol checkExpressionIsKeyword(com.io7m.jsx.SExpressionType expression, Optional<UUID> specSection, String name, String errorCode) throws CBParseFailedException Check that the expression is a keyword.- Parameters:
expression- The expressionspecSection- The quoted spec sectionname- The keyworderrorCode- The error code- Returns:
- expression
- Throws:
CBParseFailedException- On errors
-
failed
CBParseFailedException failed(com.io7m.jsx.SExpressionType expression, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode, Exception e) Parsing failed.- Parameters:
expression- The expressionfatality- The fatality levelspecSection- The quoted spec sectionerrorCode- The error codee- The exception- Returns:
- A parse exception
-
failed
CBParseFailedException failed(com.io7m.jsx.SExpressionType expression, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode) Parsing failed.- Parameters:
expression- The expressionfatality- The fatality levelspecSection- The quoted spec sectionerrorCode- The error code- Returns:
- A parse exception
-
errorCount
int errorCount()- Returns:
- The number of errors encountered so far
-
failed
CBParseFailedException failed(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, Exception exception, String errorCode) Parsing failed.- Parameters:
lexical- The lexical positionfatality- The fatality levelspecSection- The quoted spec sectionexception- The exceptionerrorCode- The error code- Returns:
- A parse exception
-
failed
CBParseFailedException failed(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode) Parsing failed.- Parameters:
lexical- The lexical positionfatality- The fatality levelspecSection- The quoted spec sectionerrorCode- The error code- Returns:
- A parse exception
-