Package com.igormaznitsa.prologparser
Interface ParserContext
-
- All Known Implementing Classes:
DefaultParserContext,ParserContextChain
public interface ParserContextContext which provides flags and operator storage for a prolog parser.- See Also:
PrologParser
-
-
Field Summary
Fields Modifier and Type Field Description static intFLAG_BLOCK_COMMENTSFlag allows block comments.static intFLAG_CURLY_BRACKETSFlag allows blocks bounded by curly brackets.static intFLAG_DOT2_AS_LISTRecognize '.'(_,_) as a list term.static intFLAG_NONEEmpty flags, no any flag defined.static intFLAG_VAR_AS_FUNCTORFlag allows variable as structure functor.static intFLAG_ZERO_QUOTATION_ALLOWS_WHITESPACE_CHARWhite-space char is allowed in zero quotation mode.static intFLAG_ZERO_QUOTATION_CHARCODEFlag allows construction 0'{char} to get char code.static intFLAG_ZERO_STRUCTFlag allows zero-arity structures.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description OpContainerfindOpForName(PrologParser source, java.lang.String name)Find operators for their name.intgetFlags()get parser flags for the parser context.default intgetMaxTokenizerBufferLength()Get maximum allowed length value for internal parser text buffers.booleanhasOpStartsWith(PrologParser source, java.lang.String namePrefix)Check that the context contains an operator starts with some string
-
-
-
Field Detail
-
FLAG_NONE
static final int FLAG_NONE
Empty flags, no any flag defined.- See Also:
- Constant Field Values
-
FLAG_BLOCK_COMMENTS
static final int FLAG_BLOCK_COMMENTS
Flag allows block comments.- See Also:
- Constant Field Values
-
FLAG_ZERO_QUOTATION_CHARCODE
static final int FLAG_ZERO_QUOTATION_CHARCODE
Flag allows construction 0'{char} to get char code. Example: 0'a, 0'\r- See Also:
- Constant Field Values
-
FLAG_VAR_AS_FUNCTOR
static final int FLAG_VAR_AS_FUNCTOR
Flag allows variable as structure functor. Example: Var(a,b,c).- See Also:
- Constant Field Values
-
FLAG_ZERO_STRUCT
static final int FLAG_ZERO_STRUCT
Flag allows zero-arity structures. Example: a().- See Also:
- Constant Field Values
-
FLAG_CURLY_BRACKETS
static final int FLAG_CURLY_BRACKETS
Flag allows blocks bounded by curly brackets. Example: {a,{b,!,c}}- See Also:
- Constant Field Values
-
FLAG_DOT2_AS_LIST
static final int FLAG_DOT2_AS_LIST
Recognize '.'(_,_) as a list term.- See Also:
- Constant Field Values
-
FLAG_ZERO_QUOTATION_ALLOWS_WHITESPACE_CHAR
static final int FLAG_ZERO_QUOTATION_ALLOWS_WHITESPACE_CHAR
White-space char is allowed in zero quotation mode.- Since:
- 2.0.2
- See Also:
- Constant Field Values
-
-
Method Detail
-
hasOpStartsWith
boolean hasOpStartsWith(PrologParser source, java.lang.String namePrefix)
Check that the context contains an operator starts with some string- Parameters:
source- source prolog parser making request, must not be nullnamePrefix- string to be used to look for operator starts with it, must not be null- Returns:
- true if there is such operator, false otherwise
-
findOpForName
OpContainer findOpForName(PrologParser source, java.lang.String name)
Find operators for their name.- Parameters:
source- source prolog parser making request, must not be nullname- name of operators, must not be null- Returns:
- operator container if such one is found, null otherwise
-
getMaxTokenizerBufferLength
default int getMaxTokenizerBufferLength()
Get maximum allowed length value for internal parser text buffers.- Returns:
- maximum allowed text parser buffers length in chars
-
getFlags
int getFlags()
get parser flags for the parser context.- Returns:
- flags as bit field
- See Also:
FLAG_NONE,FLAG_VAR_AS_FUNCTOR,FLAG_BLOCK_COMMENTS,FLAG_CURLY_BRACKETS,FLAG_ZERO_QUOTATION_CHARCODE,FLAG_ZERO_STRUCT
-
-