Home | History | Annotate | Download | only in antlr3

Lines Matching full:channel

284 manage the task of "tuning" to a specific token channel.
287 <i>channel</i> feature, which allows you to hold on to all tokens of interest
291 whitespace to channel value HIDDEN as it creates the tokens.
293 When you create a token stream, you can tune it to some specific channel value.
295 yield tokens that have the same value for <tt>channel</tt>. The stream skips
325 # the integer channel value to which the stream is ``tuned''
326 attr_accessor :channel
728 within the stream. The streams may be tuned to some channel value; off-channel
738 # assume this grammar defines whitespace as tokens on channel HIDDEN
739 # and numbers and operations as tokens on channel DEFAULT
746 # notice the #tokens method does not filter off-channel tokens
750 ANTLR3::CommonTokenStream.new(lexer, :channel => ANTLR3::HIDDEN)
769 # [:channel] The channel value the stream should be tuned to initially
774 # # create a new token stream that is tuned to channel :comment, and
776 # ANTLR3::CommonTokenStream.new(lexer, :channel => :comment) do |token|
787 @channel = options.fetch( :channel ) { stream.channel or DEFAULT_CHANNEL }
792 @channel = options.fetch( :channel, DEFAULT_CHANNEL )
800 if first_token = @tokens.find { |t| t.channel == @channel }
824 if first_token = @tokens.find { |t| t.channel == @channel }
832 # tune the stream to a new channel value
834 def tune_to( channel )
835 @channel = channel
861 token.channel != @channel
899 # advance the stream one step to the next on-channel token
912 # token at the specified position is on-channel,
920 # return the type of the on-channel token at look-ahead distance +k+. <tt>k = 1</tt> represents
921 # the current token. +k+ greater than 1 represents upcoming on-channel tokens. A negative
922 # value of +k+ returns previous on-channel tokens consumed, where <tt>k = -1</tt> is the last
923 # on-channel token consumed. <tt>k = 0</tt> has undefined behavior and returns +nil+
943 # returns the index of the on-channel token at look-ahead position +k+ or nil if no other
944 # on-channel tokens exist
954 # since the stream only yields on-channel
957 # over off-channel tokens
962 end until tk.channel == @channel
969 # returns the index of the on-channel token at look-behind position +k+ or nil if no other
970 # on-channel tokens exist before the current token
984 end until tk.channel == @channel
992 # yields each token in the stream (including off-channel tokens)
1003 # yields each token in the stream with the given channel value
1004 # If no channel value is given, the stream's tuned channel value will be used.
1007 def each_on_channel( channel = @channel )
1008 block_given? or return enum_for( :each_on_channel, channel )
1010 token.channel == channel and yield( token )
1015 # iterates through the token stream, yielding each on channel token along the way.