接口的使用
org.antlr.runtime.Token
-
使用Token的程序包 程序包 说明 org.antlr.analysis org.antlr.codegen org.antlr.grammar.v3 org.antlr.gunit org.antlr.runtime org.antlr.runtime.debug org.antlr.runtime.tree org.antlr.tool -
-
org.antlr.analysis中Token的使用
类型参数类型为Token的org.antlr.analysis中的字段 修饰符和类型 字段 说明 protected java.util.Map<DFAState,java.util.Map<java.lang.Integer,java.util.Set<Token>>>DecisionProbe. stateToIncompletelyCoveredAltsMapTracks alts insufficiently covered.返回变量类型为Token的类型的org.antlr.analysis中的方法 修饰符和类型 方法 说明 java.util.List<Token>MachineProbe. getGrammarLocationsForInputSequence(java.util.List<java.util.Set<NFAState>> nfaStates, java.util.List<IntSet> labels)Given an alternative associated with a DFA state, return the list of tokens (from grammar) associated with path through NFA following the labels sequence.java.util.Map<java.lang.Integer,java.util.Set<Token>>DecisionProbe. getIncompletelyCoveredAlts(DFAState d)Return a list of alts whose predicate context was insufficient to resolve a nondeterminism for state d.类型变量类型为Token的org.antlr.analysis中的方法参数 修饰符和类型 方法 说明 voidDecisionProbe. reportIncompletelyCoveredAlts(DFAState d, java.util.Map<java.lang.Integer,java.util.Set<Token>> altToLocationsReachableWithoutPredicate) -
org.antlr.codegen中Token的使用
参数类型为Token的org.antlr.codegen中的方法 修饰符和类型 方法 说明 voidCodeGenerator. issueInvalidAttributeError(java.lang.String x, java.lang.String y, Rule enclosingRule, Token actionToken, int outerAltNum)voidCodeGenerator. issueInvalidAttributeError(java.lang.String x, Rule enclosingRule, Token actionToken, int outerAltNum)voidCodeGenerator. issueInvalidScopeError(java.lang.String x, java.lang.String y, Rule enclosingRule, Token actionToken, int outerAltNum)java.util.List<java.lang.Object>Python3Target. postProcessAction(java.util.List<java.lang.Object> chunks, Token actionToken)java.util.List<java.lang.Object>PythonTarget. postProcessAction(java.util.List<java.lang.Object> chunks, Token actionToken)java.util.List<java.lang.Object>Target. postProcessAction(java.util.List<java.lang.Object> chunks, Token actionToken)Give target a chance to do some postprocessing on actions.org.stringtemplate.v4.STCodeGenerator. translateTemplateConstructor(java.lang.String ruleName, int outerAltNum, Token actionToken, java.lang.String templateActionText)Given a template constructor action like %foo(a={...}) in an action, translate it to the appropriate template constructor from the templateLib. -
org.antlr.grammar.v3中Token的使用
返回Token的org.antlr.grammar.v3中的方法 修饰符和类型 方法 说明 TokenActionAnalysis. nextToken()TokenActionTranslator. nextToken()TokenANTLRLexer. nextToken()参数类型为Token的org.antlr.grammar.v3中的构造器 构造器 说明 ActionTranslator(CodeGenerator generator, java.lang.String ruleName, Token actionToken, int outerAltNum) -
org.antlr.gunit中Token的使用
返回Token的org.antlr.gunit中的方法 修饰符和类型 方法 说明 TokengUnitParser. output()参数类型为Token的org.antlr.gunit中的构造器 构造器 说明 OutputTest(Token token)ReturnTest(Token retval) -
org.antlr.runtime中Token的使用
实现Token的org.antlr.runtime中的类 修饰符和类型 类 说明 classClassicTokenA Token object like we'd use in ANTLR 2.x; has an actual string created and associated with this object.classCommonToken声明为Token的org.antlr.runtime中的字段 修饰符和类型 字段 说明 static TokenToken. EOF_TOKENstatic TokenToken. INVALID_TOKENstatic TokenToken. SKIP_TOKENIn an action, a lexer rule can set token to this SKIP_TOKEN and ANTLR will avoid creating a token for this symbol and try to fetch another.TokenParserRuleReturnScope. startTokenParserRuleReturnScope. stopTokenRecognitionException. tokenThe current Token when an error occurred.TokenRecognizerSharedState. tokenThe goal of all lexer rules/methods is to create a token object.类型参数类型为Token的org.antlr.runtime中的字段 修饰符和类型 字段 说明 protected java.util.List<Token>BufferedTokenStream. tokensRecord every single token pulled from the source so we can reproduce chunks of it later.protected java.util.List<Token>LegacyCommonTokenStream. tokensRecord every single token pulled from the source so we can reproduce chunks of it later.返回Token的org.antlr.runtime中的方法 修饰符和类型 方法 说明 TokenLexer. emit()The standard method called to automatically emit a token at the outermost lexical rule.TokenBufferedTokenStream. get(int i)TokenLegacyCommonTokenStream. get(int i)Return absolute token i; ignore which channel the tokens are on; that is, count all tokens not just on-channel tokens.TokenTokenStream. get(int i)Get a token at an absolute index i; 0..n-1.TokenUnbufferedTokenStream. get(int i)TokenLexer. getEOFToken()Returns the EOF token (default), if you need to return a custom token instead override this method.TokenUnwantedTokenException. getUnexpectedToken()protected TokenBufferedTokenStream. LB(int k)protected TokenCommonTokenStream. LB(int k)protected TokenLegacyCommonTokenStream. LB(int k)Look backwards k tokens on-channel tokensTokenBufferedTokenStream. LT(int k)TokenCommonTokenStream. LT(int k)TokenLegacyCommonTokenStream. LT(int k)Get the ith token from the current position 1..n where k=1 is the first symbol of lookahead.TokenTokenStream. LT(int k)Get Token at current input pointer + i ahead where i=1 is next Token.TokenUnbufferedTokenStream. nextElement()TokenLexer. nextToken()Return a token from this source; i.e., match a token on the char stream.TokenTokenSource. nextToken()Return a Token object from your input stream (usually a CharStream).返回变量类型为Token的类型的org.antlr.runtime中的方法 修饰符和类型 方法 说明 java.util.List<? extends Token>BufferedTokenStream. get(int start, int stop)Get all tokens from start..stop inclusivelyjava.util.List<? extends Token>LegacyCommonTokenStream. get(int start, int stop)Get all tokens from start..stop inclusivelyjava.util.List<? extends Token>BufferedTokenStream. getTokens()java.util.List<? extends Token>BufferedTokenStream. getTokens(int start, int stop)java.util.List<? extends Token>BufferedTokenStream. getTokens(int start, int stop, int ttype)java.util.List<? extends Token>BufferedTokenStream. getTokens(int start, int stop, java.util.List<java.lang.Integer> types)java.util.List<? extends Token>BufferedTokenStream. getTokens(int start, int stop, BitSet types)Given a start and stop index, return a List of all tokens in the token type BitSet.java.util.List<? extends Token>LegacyCommonTokenStream. getTokens()java.util.List<? extends Token>LegacyCommonTokenStream. getTokens(int start, int stop)java.util.List<? extends Token>LegacyCommonTokenStream. getTokens(int start, int stop, int ttype)java.util.List<? extends Token>LegacyCommonTokenStream. getTokens(int start, int stop, java.util.List<java.lang.Integer> types)java.util.List<? extends Token>LegacyCommonTokenStream. getTokens(int start, int stop, BitSet types)Given a start and stop index, return a List of all tokens in the token type BitSet.参数类型为Token的org.antlr.runtime中的方法 修饰符和类型 方法 说明 voidTokenRewriteStream. delete(java.lang.String programName, Token from, Token to)voidTokenRewriteStream. delete(Token indexT)voidTokenRewriteStream. delete(Token from, Token to)voidLexer. emit(Token token)Currently does not support multiple emits per nextToken invocation for efficiency reasons.java.lang.StringBaseRecognizer. getTokenErrorDisplay(Token t)How should a token be displayed in an error message? The default is to display just the text, but during development you might want to have a lot of information spit out.voidTokenRewriteStream. insertAfter(java.lang.String programName, Token t, java.lang.Object text)voidTokenRewriteStream. insertAfter(Token t, java.lang.Object text)voidTokenRewriteStream. insertBefore(java.lang.String programName, Token t, java.lang.Object text)voidTokenRewriteStream. insertBefore(Token t, java.lang.Object text)booleanUnbufferedTokenStream. isEOF(Token o)voidTokenRewriteStream. replace(java.lang.String programName, Token from, Token to, java.lang.Object text)voidTokenRewriteStream. replace(Token indexT, java.lang.Object text)voidTokenRewriteStream. replace(Token from, Token to, java.lang.Object text)java.lang.StringBufferedTokenStream. toString(Token start, Token stop)java.lang.StringLegacyCommonTokenStream. toString(Token start, Token stop)java.lang.StringTokenStream. toString(Token start, Token stop)Because the user is not required to use a token with an index stored in it, we must provide a means for two token objects themselves to indicate the start/end location.java.lang.StringUnbufferedTokenStream. toString(Token start, Token stop)类型变量类型为Token的org.antlr.runtime中的方法参数 修饰符和类型 方法 说明 java.util.List<java.lang.String>BaseRecognizer. toStrings(java.util.List<? extends Token> tokens)A convenience method for use most often with template rewrites.参数类型为Token的org.antlr.runtime中的构造器 构造器 说明 ClassicToken(Token oldToken)CommonToken(Token oldToken) -
org.antlr.runtime.debug中Token的使用
实现Token的org.antlr.runtime.debug中的类 修饰符和类型 类 说明 static classRemoteDebugEventSocketListener.ProxyToken声明为Token的org.antlr.runtime.debug中的字段 修饰符和类型 字段 说明 protected TokenProfiler. lastRealTokenTouchedInDecision返回Token的org.antlr.runtime.debug中的方法 修饰符和类型 方法 说明 TokenDebugTokenStream. get(int i)TokenDebugTreeAdaptor. getToken(java.lang.Object t)TokenDebugTokenStream. LT(int i)参数类型为Token的org.antlr.runtime.debug中的方法 修饰符和类型 方法 说明 voidDebugTreeAdaptor. addChild(java.lang.Object t, Token child)java.lang.ObjectDebugTreeAdaptor. becomeRoot(Token newRoot, java.lang.Object oldRoot)voidBlankDebugEventListener. consumeHiddenToken(Token token)voidDebugEventHub. consumeHiddenToken(Token token)voidDebugEventListener. consumeHiddenToken(Token t)An off-channel input token was consumed.voidDebugEventRepeater. consumeHiddenToken(Token token)voidDebugEventSocketProxy. consumeHiddenToken(Token t)voidParseTreeBuilder. consumeHiddenToken(Token token)voidProfiler. consumeHiddenToken(Token token)voidBlankDebugEventListener. consumeToken(Token token)voidDebugEventHub. consumeToken(Token token)voidDebugEventListener. consumeToken(Token t)An input token was consumed; matched by any kind of element.voidDebugEventRepeater. consumeToken(Token token)voidDebugEventSocketProxy. consumeToken(Token t)voidParseTreeBuilder. consumeToken(Token token)voidProfiler. consumeToken(Token token)java.lang.ObjectDebugTreeAdaptor. create(int tokenType, Token fromToken)java.lang.ObjectDebugTreeAdaptor. create(int tokenType, Token fromToken, java.lang.String text)java.lang.ObjectDebugTreeAdaptor. create(Token payload)voidBlankDebugEventListener. createNode(java.lang.Object node, Token token)voidDebugEventHub. createNode(java.lang.Object node, Token token)voidDebugEventListener. createNode(java.lang.Object node, Token token)Announce a new node built from an existing token.voidDebugEventRepeater. createNode(java.lang.Object node, Token token)voidDebugEventSocketProxy. createNode(java.lang.Object node, Token token)voidTraceDebugEventListener. createNode(java.lang.Object node, Token token)java.lang.ObjectDebugTreeAdaptor. errorNode(TokenStream input, Token start, Token stop, RecognitionException e)voidBlankDebugEventListener. LT(int i, Token t)voidDebugEventHub. LT(int index, Token t)voidDebugEventListener. LT(int i, Token t)Somebody (anybody) looked ahead.voidDebugEventRepeater. LT(int i, Token t)voidDebugEventSocketProxy. LT(int i, Token t)voidProfiler. LT(int i, Token t)Track refs to lookahead if in a fixed/nonfixed decision.protected java.lang.StringDebugEventSocketProxy. serializeToken(Token t)voidDebugTreeAdaptor. setTokenBoundaries(java.lang.Object t, Token startToken, Token stopToken)java.lang.StringDebugTokenStream. toString(Token start, Token stop) -
org.antlr.runtime.tree中Token的使用
声明为Token的org.antlr.runtime.tree中的字段 修饰符和类型 字段 说明 TokenCommonErrorNode. startTokenCommonErrorNode. stopTokenCommonTree. tokenA single token is the payload类型参数类型为Token的org.antlr.runtime.tree中的字段 修饰符和类型 字段 说明 java.util.List<Token>ParseTree. hiddenTokens返回Token的org.antlr.runtime.tree中的方法 修饰符和类型 方法 说明 abstract TokenBaseTreeAdaptor. createToken(int tokenType, java.lang.String text)Tell me how to create a token for use with imaginary token nodes.abstract TokenBaseTreeAdaptor. createToken(Token fromToken)Tell me how to create a token for use with imaginary token nodes.TokenCommonTreeAdaptor. createToken(int tokenType, java.lang.String text)Tell me how to create a token for use with imaginary token nodes.TokenCommonTreeAdaptor. createToken(Token fromToken)Tell me how to create a token for use with imaginary token nodes.TokenCommonTree. getToken()TokenCommonTreeAdaptor. getToken(java.lang.Object t)What is the Token associated with this node? If you are not using CommonTree, then you must override this in your own adaptor.TokenTreeAdaptor. getToken(java.lang.Object t)Return the token object from which this node was created.TokenRewriteRuleTokenStream. nextToken()参数类型为Token的org.antlr.runtime.tree中的方法 修饰符和类型 方法 说明 java.lang.ObjectBaseTreeAdaptor. becomeRoot(Token newRoot, java.lang.Object oldRoot)java.lang.ObjectTreeAdaptor. becomeRoot(Token newRoot, java.lang.Object oldRoot)Create a node for newRoot make it the root of oldRoot.java.lang.ObjectBaseTreeAdaptor. create(int tokenType, Token fromToken)java.lang.ObjectBaseTreeAdaptor. create(int tokenType, Token fromToken, java.lang.String text)java.lang.ObjectCommonTreeAdaptor. create(Token payload)java.lang.ObjectTreeAdaptor. create(int tokenType, Token fromToken)Create a new node derived from a token, with a new token type.java.lang.ObjectTreeAdaptor. create(int tokenType, Token fromToken, java.lang.String text)Same as create(tokenType,fromToken) except set the text too.java.lang.ObjectTreeAdaptor. create(Token payload)Create a tree node from Token object; for CommonTree type trees, then the token just becomes the payload.java.lang.ObjectTreeWizard.TreePatternTreeAdaptor. create(Token payload)abstract TokenBaseTreeAdaptor. createToken(Token fromToken)Tell me how to create a token for use with imaginary token nodes.TokenCommonTreeAdaptor. createToken(Token fromToken)Tell me how to create a token for use with imaginary token nodes.java.lang.ObjectBaseTreeAdaptor. errorNode(TokenStream input, Token start, Token stop, RecognitionException e)create tree node that holds the start and stop tokens associated with an error.java.lang.ObjectTreeAdaptor. errorNode(TokenStream input, Token start, Token stop, RecognitionException e)Return a tree node representing an error.voidCommonTreeAdaptor. setTokenBoundaries(java.lang.Object t, Token startToken, Token stopToken)Track start/stop token for subtree root created for a rule.voidTreeAdaptor. setTokenBoundaries(java.lang.Object t, Token startToken, Token stopToken)Where are the bounds in the input token stream for this node and all children? Each rule that creates AST nodes will call this method right before returning.参数类型为Token的org.antlr.runtime.tree中的构造器 构造器 说明 CommonErrorNode(TokenStream input, Token start, Token stop, RecognitionException e)CommonTree(Token t)TreePattern(Token payload)WildcardTreePattern(Token payload) -
org.antlr.tool中Token的使用
声明为Token的org.antlr.tool中的字段 修饰符和类型 字段 说明 TokenAttributeScope. derivedFromTokenThis scope is associated with which input token (for error handling)?TokenGrammar.LabelElementPair. labelTokenGrammarSemanticsMessage. offendingTokenMost of the time, we'll have a token such as an undefined rule ref and so this will be set.TokenGrammarSyntaxMessage. offendingTokenMost of the time, we'll have a token and so this will be set.类型参数类型为Token的org.antlr.tool中的字段 修饰符和类型 字段 说明 java.util.Map<java.lang.Integer,java.util.Set<Token>>GrammarInsufficientPredicatesMessage. altToLocationsprotected java.util.Set<Token>Grammar. tokenIDRefsThe unique set of all token ID references in any rule返回Token的org.antlr.tool中的方法 修饰符和类型 方法 说明 TokenInterpreter. nextToken()参数类型为Token的org.antlr.tool中的方法 修饰符和类型 方法 说明 protected voidNameSpaceChecker. checkForLabelConflict(Rule r, Token label)Make sure a label doesn't conflict with another symbol.booleanNameSpaceChecker. checkForLabelTypeMismatch(Rule r, Token label, int type)If type of previous label differs from new label's type, that's an error.AttributeScopeGrammar. createParameterScope(java.lang.String ruleName, Token argAction)AttributeScopeGrammar. createReturnScope(java.lang.String ruleName, Token retAction)AttributeScopeGrammar. createRuleScope(java.lang.String ruleName, Token scopeAction)AttributeScopeGrammar. defineGlobalScope(java.lang.String name, Token scopeAction)protected voidGrammar. defineLabel(Rule r, Token label, GrammarAST element, int type)Define a label defined in a rule r; check the validity then ask the Rule object to actually define it.voidRule. defineLabel(Token label, GrammarAST elementRef, int type)voidGrammar. defineLexerRuleFoundInParser(Token ruleToken, GrammarAST ruleAST)voidGrammar. defineRule(Token ruleToken, java.lang.String modifier, java.util.Map<java.lang.String,java.lang.Object> options, GrammarAST tree, GrammarAST argActionAST, int numAlts)Define a new rule.voidGrammar. defineRuleListLabel(java.lang.String ruleName, Token label, GrammarAST element)voidGrammar. defineRuleRefLabel(java.lang.String ruleName, Token label, GrammarAST ruleRef)voidGrammar. defineTokenListLabel(java.lang.String ruleName, Token label, GrammarAST element)voidGrammar. defineTokenRefLabel(java.lang.String ruleName, Token label, GrammarAST tokenRef)voidGrammar. defineWildcardTreeLabel(java.lang.String ruleName, Token label, GrammarAST tokenRef)voidGrammar. defineWildcardTreeListLabel(java.lang.String ruleName, Token label, GrammarAST tokenRef)java.util.Collection<java.lang.String>LeftRecursiveRuleAnalyzer. getNamesFromArgAction(Token t)static voidErrorManager. grammarError(int msgID, Grammar g, Token token)static voidErrorManager. grammarError(int msgID, Grammar g, Token token, java.lang.Object arg)static voidErrorManager. grammarError(int msgID, Grammar g, Token token, java.lang.Object arg, java.lang.Object arg2)static voidErrorManager. grammarWarning(int msgID, Grammar g, Token token)static voidErrorManager. grammarWarning(int msgID, Grammar g, Token token, java.lang.Object arg)static voidErrorManager. grammarWarning(int msgID, Grammar g, Token token, java.lang.Object arg, java.lang.Object arg2)voidGrammarAST. initialize(Token token)java.lang.StringGrammar. setOption(java.lang.String key, java.lang.Object value, Token optionsStartToken)Save the option key/value pair and process it; return the key or null if invalid option.java.lang.StringRule. setOption(java.lang.String key, java.lang.Object value, Token optionsStartToken)Save the option key/value pair and process it; return the key or null if invalid option.voidGrammar. setOptions(java.util.Map<java.lang.String,java.lang.Object> options, Token optionsStartToken)voidRule. setOptions(java.util.Map<java.lang.String,java.lang.Object> options, Token optionsStartToken)voidGrammarAST. setTokenBoundaries(Token startToken, Token stopToken)Track start/stop token for subtree root created for a rule.static voidErrorManager. syntaxError(int msgID, Grammar grammar, Token token, java.lang.Object arg, RecognitionException re)类型变量类型为Token的org.antlr.tool中的方法参数 修饰符和类型 方法 说明 static voidErrorManager. insufficientPredicates(DecisionProbe probe, DFAState d, java.util.Map<java.lang.Integer,java.util.Set<Token>> altToUncoveredLocations)参数类型为Token的org.antlr.tool中的构造器 构造器 说明 AttributeScope(java.lang.String name, Token derivedFromToken)AttributeScope(Grammar grammar, java.lang.String name, Token derivedFromToken)GrammarAST(Token token)GrammarSemanticsMessage(int msgID, Grammar g, Token offendingToken)GrammarSemanticsMessage(int msgID, Grammar g, Token offendingToken, java.lang.Object arg)GrammarSemanticsMessage(int msgID, Grammar g, Token offendingToken, java.lang.Object arg, java.lang.Object arg2)GrammarSyntaxMessage(int msgID, Grammar grammar, Token offendingToken, java.lang.Object arg, RecognitionException exception)GrammarSyntaxMessage(int msgID, Grammar grammar, Token offendingToken, RecognitionException exception)LabelElementPair(Token label, GrammarAST elementRef)RuleLabelScope(Rule referencedRule, Token actionToken)类型变量类型为Token的org.antlr.tool中的构造器参数 构造器 说明 GrammarInsufficientPredicatesMessage(DecisionProbe probe, DFAState problemState, java.util.Map<java.lang.Integer,java.util.Set<Token>> altToLocations)
-