Package com.igormaznitsa.prologparser
Class ParserContextChain
- java.lang.Object
-
- com.igormaznitsa.prologparser.ParserContextChain
-
- All Implemented Interfaces:
ParserContext
public class ParserContextChain extends java.lang.Object implements ParserContext
Auxiliary class allows to make chain of prolog contexts.
-
-
Field Summary
Fields Modifier and Type Field Description private ParserContext[]contextsprivate intminDetectedAllowedBufferSizeprivate inttokenizerFlags-
Fields inherited from interface com.igormaznitsa.prologparser.ParserContext
FLAG_BLOCK_COMMENTS, FLAG_CURLY_BRACKETS, FLAG_DOT2_AS_LIST, FLAG_NONE, FLAG_VAR_AS_FUNCTOR, FLAG_ZERO_QUOTATION_ALLOWS_WHITESPACE_CHAR, FLAG_ZERO_QUOTATION_CHARCODE, FLAG_ZERO_STRUCT
-
-
Constructor Summary
Constructors Constructor Description ParserContextChain(ParserContext... contexts)
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.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 stringstatic ParserContextof(ParserContext... contexts)
-
-
-
Field Detail
-
contexts
private final ParserContext[] contexts
-
tokenizerFlags
private final int tokenizerFlags
-
minDetectedAllowedBufferSize
private final int minDetectedAllowedBufferSize
-
-
Constructor Detail
-
ParserContextChain
public ParserContextChain(ParserContext... contexts)
-
-
Method Detail
-
of
public static ParserContext of(ParserContext... contexts)
-
getMaxTokenizerBufferLength
public int getMaxTokenizerBufferLength()
Description copied from interface:ParserContextGet maximum allowed length value for internal parser text buffers.- Specified by:
getMaxTokenizerBufferLengthin interfaceParserContext- Returns:
- maximum allowed text parser buffers length in chars
-
hasOpStartsWith
public boolean hasOpStartsWith(PrologParser source, java.lang.String namePrefix)
Description copied from interface:ParserContextCheck that the context contains an operator starts with some string- Specified by:
hasOpStartsWithin interfaceParserContext- 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
public OpContainer findOpForName(PrologParser source, java.lang.String name)
Description copied from interface:ParserContextFind operators for their name.- Specified by:
findOpForNamein interfaceParserContext- 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
-
getFlags
public int getFlags()
Description copied from interface:ParserContextget parser flags for the parser context.- Specified by:
getFlagsin interfaceParserContext- Returns:
- flags as bit field
- See Also:
ParserContext.FLAG_NONE,ParserContext.FLAG_VAR_AS_FUNCTOR,ParserContext.FLAG_BLOCK_COMMENTS,ParserContext.FLAG_CURLY_BRACKETS,ParserContext.FLAG_ZERO_QUOTATION_CHARCODE,ParserContext.FLAG_ZERO_STRUCT
-
-