Ben Gruver | 324c464 | 2011-11-15 16:02:09 -0800 | [diff] [blame^] | 1 | #!/usr/bin/ruby |
| 2 | # encoding: utf-8 |
| 3 | |
| 4 | require 'antlr3/test/functional' |
| 5 | |
| 6 | class TestSyntacticPredicate < ANTLR3::Test::Functional |
| 7 | inline_grammar( <<-'END' ) |
| 8 | lexer grammar SyntacticPredicateGate; |
| 9 | options { |
| 10 | language = Ruby; |
| 11 | } |
| 12 | |
| 13 | FOO |
| 14 | : ('ab')=> A |
| 15 | | ('ac')=> B |
| 16 | ; |
| 17 | |
| 18 | fragment |
| 19 | A: 'a'; |
| 20 | |
| 21 | fragment |
| 22 | B: 'a'; |
| 23 | END |
| 24 | |
| 25 | example 'gating syntactic predicate rule' do |
| 26 | lexer = SyntacticPredicateGate::Lexer.new( 'ac' ) |
| 27 | token = lexer.next_token |
| 28 | end |
| 29 | |
| 30 | |
| 31 | end |