Class: RuleTagToken
Constant Summary
Constants inherited from Token
Token::DEFAULT_CHANNEL, Token::EOF, Token::EPSILON, Token::HIDDEN_CHANNEL, Token::INVALID_TYPE, Token::MIN_USER_TOKEN_TYPE
Instance Attribute Summary collapse
-
#label ⇒ Object
Constructs a new instance of RuleTagToken with the specified rule name, bypass token type, and label.
-
#ruleName ⇒ Object
Constructs a new instance of RuleTagToken with the specified rule name, bypass token type, and label.
Attributes inherited from Token
#channel, #column, #line, #source, #start, #stop, #text, #tokenIndex, #type
Instance Method Summary collapse
- #getText ⇒ Object
-
#initialize(ruleName, bypassTokenType, label = nil) ⇒ RuleTagToken
constructor
A new instance of RuleTagToken.
Methods inherited from Token
#getInputStream, #getTokenSource
Constructor Details
#initialize(ruleName, bypassTokenType, label = nil) ⇒ RuleTagToken
Returns a new instance of RuleTagToken.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/antlr4/tree/RuleTagToken.rb', line 16 def initialize(ruleName, bypassTokenType, label=nil) if ruleName.nil? or ruleName.length ==0 then raise Exception.new("ruleName cannot be null or empty.") end self.source = nil self.type = bypassTokenType # token type of the token self.channel = Token::DEFAULT_CHANNEL # The parser ignores everything not on DEFAULT_CHANNEL self.start = -1 # optional; return -1 if not implemented. self.stop = -1 # optional; return -1 if not implemented. self.tokenIndex = -1 # from 0..n-1 of the token object in the input stream self.line = 0 # line=1..n of the 1st character self.column = -1 # beginning of the line at which it occurs, 0..n-1 self.label = label self.ruleName = ruleName @text = getText() end |
Instance Attribute Details
#label ⇒ Object
Constructs a new instance of RuleTagToken with the specified rule name, bypass token type, and label.
the rule tag is unlabeled.
or empty.
14 15 16 |
# File 'lib/antlr4/tree/RuleTagToken.rb', line 14 def label @label end |
#ruleName ⇒ Object
Constructs a new instance of RuleTagToken with the specified rule name, bypass token type, and label.
the rule tag is unlabeled.
or empty.
14 15 16 |
# File 'lib/antlr4/tree/RuleTagToken.rb', line 14 def ruleName @ruleName end |
Instance Method Details
#getText ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/antlr4/tree/RuleTagToken.rb', line 32 def getText() if self.label.nil? then "<#{@ruleName}>" else "<#{@label}:#{@ruleName}>" end end |