antlr3 1.8.10 → 1.8.11

Sign up to get free protection for your applications and to get access to all the features.
data/bin/antlr4ruby CHANGED
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
@@ -80,6 +80,13 @@ end
80
80
 
81
81
  jar = ANTLR3.antlr_jar or fail( "cannot find antlr4ruby's customized ANTLR jar" )
82
82
 
83
+ # Convert the Posix path to a proper Windows path, otherwise the Java runtime
84
+ # will not find the antlr Jar file.
85
+ # -- Thanks to Marco Soeima for this fix
86
+ if /mswin32|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM
87
+ jar = `cygpath -aw #{jar}`.strip
88
+ end
89
+
83
90
  run = proc do | *args |
84
91
  exec( 'java', '-jar', jar, *args )
85
92
  end
Binary file
data/lib/antlr3.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
data/lib/antlr3/debug.rb CHANGED
@@ -6,7 +6,7 @@ require 'antlr3'
6
6
  =begin LICENSE
7
7
 
8
8
  [The "BSD licence"]
9
- Copyright (c) 2009-2010 Kyle Yetter
9
+ Copyright (c) 2009-2011 Kyle Yetter
10
10
  All rights reserved.
11
11
 
12
12
  Redistribution and use in source and binary forms, with or without
data/lib/antlr3/dfa.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
data/lib/antlr3/dot.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
data/lib/antlr3/error.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
data/lib/antlr3/main.rb CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  =begin LICENSE
5
5
  [The "BSD licence"]
6
- Copyright (c) 2009-2010 Kyle Yetter
6
+ Copyright (c) 2009-2011 Kyle Yetter
7
7
  All rights reserved.
8
8
 
9
9
  Redistribution and use in source and binary forms, with or without
@@ -80,7 +80,7 @@ module Options
80
80
  oparser = OptionParser.new do | o |
81
81
  o.separator 'Input Options:'
82
82
 
83
- o.on( '-i', '--input "text to process"', doc( <<-END ) ) { |val| @input = val }
83
+ o.on( '-i', '-e', '--input "text to process"', doc( <<-END ) ) { |val| @input = val }
84
84
  | a string to use as direct input to the recognizer
85
85
  END
86
86
 
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
@@ -33,20 +33,12 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
33
  =end
34
34
 
35
35
  module ANTLR3
36
-
37
- =begin rdoc ANTLR3::TokenRewriteStream
38
-
39
- TokenRewriteStream is a specialized form of CommonTokenStream that provides simple stream editing functionality. By creating <i>rewrite programs</i>, new text output can be created based upon the tokens in the stream. The basic token stream itself is preserved, and text output is rendered on demand using the #to_s method.
40
-
41
- =end
42
-
43
- class TokenRewriteStream < CommonTokenStream
44
-
36
+ module Rewrite
45
37
  unless defined?( RewriteOperation )
46
38
  RewriteOperation = Struct.new( :stream, :location, :text )
47
39
  end
48
40
 
49
- =begin rdoc ANTLR3::TokenRewriteStream::RewriteOperation
41
+ =begin rdoc ANTLR3::Rewrite::RewriteOperation
50
42
 
51
43
  RewiteOperation objects represent some particular editing command that should
52
44
  be executed by a token rewrite stream at some time in future when the stream is
@@ -90,9 +82,8 @@ define specific implementations of stream edits.
90
82
  return "(%s @ %p : %p)" % [ name, location, text ]
91
83
  end
92
84
  end
93
-
94
85
 
95
- =begin rdoc ANTLR3::TokenRewriteStream::InsertBefore
86
+ =begin rdoc ANTLR3::Rewrite::InsertBefore
96
87
 
97
88
  Represents rewrite operation:
98
89
 
@@ -115,7 +106,7 @@ text content of the token at index <tt>op.index</tt>
115
106
  end
116
107
  end
117
108
 
118
- =begin rdoc ANTLR3::TokenRewriteStream::Replace
109
+ =begin rdoc ANTLR3::Rewrite::Replace
119
110
 
120
111
  Represents rewrite operation:
121
112
 
@@ -153,7 +144,7 @@ indexed within the range <tt>op.index .. op.last_index</tt>
153
144
 
154
145
  end
155
146
 
156
- =begin rdoc ANTLR3::TokenRewriteStream::Delete
147
+ =begin rdoc ANTLR3::Rewrite::Delete
157
148
 
158
149
  Represents rewrite operation:
159
150
 
@@ -360,10 +351,7 @@ and do not add any text to the rewrite buffer
360
351
  end
361
352
 
362
353
  attr_reader :programs
363
-
364
- def initialize( token_source, options = {} )
365
- super( token_source, options )
366
-
354
+ def initialize_rewrite
367
355
  @programs = Hash.new do |programs, name|
368
356
  if name.is_a?( String )
369
357
  programs[ name ] = RewriteProgram.new( self, name )
@@ -374,6 +362,8 @@ and do not add any text to the rewrite buffer
374
362
  @last_rewrite_token_indexes = {}
375
363
  end
376
364
 
365
+ private :initialize_rewrite
366
+
377
367
  def rewrite( program_name = 'default', range = nil )
378
368
  program = @programs[ program_name ]
379
369
  if block_given?
@@ -421,4 +411,23 @@ and do not add any text to the rewrite buffer
421
411
  @programs[ name ].execute( *arguments )
422
412
  end
423
413
  end
414
+
415
+ =begin rdoc ANTLR3::TokenRewriteStream
416
+
417
+ TokenRewriteStream is a specialized form of CommonTokenStream that
418
+ provides simple stream editing functionality. By creating
419
+ <i>rewrite programs</i>, new text output can be created based upon
420
+ the tokens in the stream. The basic token stream itself is preserved,
421
+ and text output is rendered on demand using the #to_s method.
422
+
423
+ =end
424
+
425
+ class TokenRewriteStream < CommonTokenStream
426
+ include Rewrite
427
+
428
+ def initialize( token_source, options = {} )
429
+ super( token_source, options )
430
+ initialize_rewrite
431
+ end
432
+ end
424
433
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  =begin ::about::
5
5
  author: Kyle Yetter <kcy5b@yahoo.com>
6
- created on: October 22, 2010
6
+ created on: October 22, 2011
7
7
  purpose: (program | library | utility script | ?)
8
8
  summary:
9
9
  loads: files required by this
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # GroupFile.g
4
- #
5
- # Generated using ANTLR version: 3.2.1-SNAPSHOT Jun 18, 2010 05:38:11
6
- # Ruby runtime library version: 1.7.5
4
+ # --
5
+ # Generated using ANTLR version: 3.2.1-SNAPSHOT Jul 31, 2010 19:34:52
6
+ # Ruby runtime library version: 1.8.8
7
7
  # Input grammar file: GroupFile.g
8
- # Generated at: 2010-07-03 23:15:35
8
+ # Generated at: 2011-03-26 15:54:23
9
9
  #
10
10
 
11
11
  # ~~~> start load path setup
@@ -16,7 +16,7 @@ antlr_load_failed = proc do
16
16
  load_path = $LOAD_PATH.map { |dir| ' - ' << dir }.join( $/ )
17
17
  raise LoadError, <<-END.strip!
18
18
 
19
- Failed to load the ANTLR3 runtime library (version 1.7.5):
19
+ Failed to load the ANTLR3 runtime library (version 1.8.8):
20
20
 
21
21
  Ensure the library has been installed on your system and is available
22
22
  on the load path. If rubygems is available on your system, this can
@@ -46,7 +46,7 @@ rescue LoadError
46
46
 
47
47
  # 3: try to activate the antlr3 gem
48
48
  begin
49
- Gem.activate( 'antlr3', '~> 1.7.5' )
49
+ Gem.activate( 'antlr3', '~> 1.8.8' )
50
50
  rescue Gem::LoadError
51
51
  antlr_load_failed.call
52
52
  end
@@ -89,7 +89,7 @@ module GroupFile
89
89
 
90
90
 
91
91
  begin
92
- generated_using( "GroupFile.g", "3.2.1-SNAPSHOT Jun 18, 2010 05:38:11", "1.7.5" )
92
+ generated_using( "GroupFile.g", "3.2.1-SNAPSHOT Jul 31, 2010 19:34:52", "1.8.8" )
93
93
  rescue NoMethodError => error
94
94
  # ignore
95
95
  end
@@ -374,7 +374,7 @@ module GroupFile
374
374
  case alt_1
375
375
  when 1
376
376
  # at line
377
- if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek( 1 ) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )
377
+ if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )
378
378
  @input.consume
379
379
  else
380
380
  mse = MismatchedSet( nil )
@@ -411,7 +411,7 @@ module GroupFile
411
411
 
412
412
  # - - - - main rule block - - - -
413
413
  # at line 129:5: ( 'a' .. 'z' | '_' ) ( 'a' .. 'z' | '_' | 'A' .. 'Z' | '0' .. '9' )*
414
- if @input.peek( 1 ) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )
414
+ if @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )
415
415
  @input.consume
416
416
  else
417
417
  mse = MismatchedSet( nil )
@@ -432,7 +432,7 @@ module GroupFile
432
432
  case alt_2
433
433
  when 1
434
434
  # at line
435
- if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek( 1 ) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )
435
+ if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )
436
436
  @input.consume
437
437
  else
438
438
  mse = MismatchedSet( nil )
@@ -793,7 +793,7 @@ module GroupFile
793
793
  case alt_11
794
794
  when 1
795
795
  # at line
796
- if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek( 1 ).between?( 0xc, 0xd ) || @input.peek( 1 ) == 0x20
796
+ if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek( 1 ).between?( 0xc, 0xd ) || @input.peek(1) == 0x20
797
797
  @input.consume
798
798
  else
799
799
  mse = MismatchedSet( nil )
@@ -805,7 +805,7 @@ module GroupFile
805
805
 
806
806
  else
807
807
  match_count_11 > 0 and break
808
- eee = EarlyExit( 11 )
808
+ eee = EarlyExit(11)
809
809
 
810
810
 
811
811
  raise eee
@@ -920,7 +920,7 @@ module GroupFile
920
920
  1, 11, 1, 12, 1, 13, 1, 14, 1, 15, 1, 16, 3, -1,
921
921
  1, 4, 1, 2, 2, -1, 1, 1 )
922
922
  SPECIAL = unpack( 24, -1 )
923
- TRANSITION = [
923
+ TRANSITION = [
924
924
  unpack( 2, 15, 1, -1, 2, 15, 18, -1, 1, 15, 1, -1, 1, 13, 1, 14,
925
925
  2, -1, 1, 8, 1, 13, 1, 4, 1, 5, 1, 7, 1, -1, 1, 6, 2, -1,
926
926
  1, 14, 10, -1, 1, 2, 1, 3, 1, 12, 1, 9, 3, -1, 26, 10, 4,
@@ -986,3 +986,5 @@ end # module Template
986
986
  end # module ANTLR3
987
987
 
988
988
  # - - - - - - end action @lexer::footer - - - - - - -
989
+
990
+
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # GroupFile.g
4
- #
5
- # Generated using ANTLR version: 3.2.1-SNAPSHOT Jun 18, 2010 05:38:11
6
- # Ruby runtime library version: 1.7.5
4
+ # --
5
+ # Generated using ANTLR version: 3.2.1-SNAPSHOT Jul 31, 2010 19:34:52
6
+ # Ruby runtime library version: 1.8.8
7
7
  # Input grammar file: GroupFile.g
8
- # Generated at: 2010-07-03 23:15:35
8
+ # Generated at: 2011-03-26 15:54:23
9
9
  #
10
10
 
11
11
  # ~~~> start load path setup
@@ -16,7 +16,7 @@ antlr_load_failed = proc do
16
16
  load_path = $LOAD_PATH.map { |dir| ' - ' << dir }.join( $/ )
17
17
  raise LoadError, <<-END.strip!
18
18
 
19
- Failed to load the ANTLR3 runtime library (version 1.7.5):
19
+ Failed to load the ANTLR3 runtime library (version 1.8.8):
20
20
 
21
21
  Ensure the library has been installed on your system and is available
22
22
  on the load path. If rubygems is available on your system, this can
@@ -46,7 +46,7 @@ rescue LoadError
46
46
 
47
47
  # 3: try to activate the antlr3 gem
48
48
  begin
49
- Gem.activate( 'antlr3', '~> 1.7.5' )
49
+ Gem.activate( 'antlr3', '~> 1.8.8' )
50
50
  rescue Gem::LoadError
51
51
  antlr_load_failed.call
52
52
  end
@@ -103,7 +103,7 @@ module GroupFile
103
103
  include TokenData
104
104
 
105
105
  begin
106
- generated_using( "GroupFile.g", "3.2.1-SNAPSHOT Jun 18, 2010 05:38:11", "1.7.5" )
106
+ generated_using( "GroupFile.g", "3.2.1-SNAPSHOT Jul 31, 2010 19:34:52", "1.8.8" )
107
107
  rescue NoMethodError => error
108
108
  # ignore
109
109
  end
@@ -130,7 +130,7 @@ module GroupFile
130
130
  def unescape( text )
131
131
  text.gsub( /\\(?:([abefnrstv])|([0-7]{3})|x([0-9a-fA-F]{2})|(.))/ ) do
132
132
  if $1
133
- case $1[ 0 ]
133
+ case $1[0]
134
134
  when ?a then "\a"
135
135
  when ?b then "\b"
136
136
  when ?e then "\e"
@@ -153,7 +153,7 @@ module GroupFile
153
153
  when TEMPLATE
154
154
  token.text.gsub( /\A<<<\r?\n?|\r?\n?>>>\Z/, '' )
155
155
  when STRING
156
- unescape( token.text[ 1...-1 ] )
156
+ unescape( token.text[1...-1] )
157
157
  end
158
158
  end
159
159
 
@@ -227,8 +227,8 @@ module GroupFile
227
227
  end # loop for decision 2
228
228
 
229
229
  rescue ANTLR3::Error::RecognitionError => re
230
- report_error( re )
231
- recover( re )
230
+ report_error(re)
231
+ recover(re)
232
232
 
233
233
  ensure
234
234
  # -> uncomment the next line to manually enable rule tracing
@@ -302,8 +302,8 @@ module GroupFile
302
302
  end
303
303
 
304
304
  rescue ANTLR3::Error::RecognitionError => re
305
- report_error( re )
306
- recover( re )
305
+ report_error(re)
306
+ recover(re)
307
307
 
308
308
  ensure
309
309
  # -> uncomment the next line to manually enable rule tracing
@@ -388,8 +388,8 @@ module GroupFile
388
388
  end
389
389
 
390
390
  rescue ANTLR3::Error::RecognitionError => re
391
- report_error( re )
392
- recover( re )
391
+ report_error(re)
392
+ recover(re)
393
393
 
394
394
  ensure
395
395
  # -> uncomment the next line to manually enable rule tracing
@@ -463,8 +463,8 @@ module GroupFile
463
463
 
464
464
  end
465
465
  rescue ANTLR3::Error::RecognitionError => re
466
- report_error( re )
467
- recover( re )
466
+ report_error(re)
467
+ recover(re)
468
468
 
469
469
  ensure
470
470
  # -> uncomment the next line to manually enable rule tracing
@@ -517,8 +517,8 @@ module GroupFile
517
517
  end # loop for decision 9
518
518
 
519
519
  rescue ANTLR3::Error::RecognitionError => re
520
- report_error( re )
521
- recover( re )
520
+ report_error(re)
521
+ recover(re)
522
522
 
523
523
  ensure
524
524
  # -> uncomment the next line to manually enable rule tracing
@@ -598,8 +598,8 @@ module GroupFile
598
598
 
599
599
  end
600
600
  rescue ANTLR3::Error::RecognitionError => re
601
- report_error( re )
602
- recover( re )
601
+ report_error(re)
602
+ recover(re)
603
603
 
604
604
  ensure
605
605
  # -> uncomment the next line to manually enable rule tracing
@@ -658,9 +658,9 @@ if __FILE__ == $0 and ARGV.first != '--'
658
658
  # GroupFile.g
659
659
 
660
660
 
661
- defined?( ANTLR3::Template::GroupFile::Lexer ) or require 'antlr3/template/group-file'
661
+ defined?(ANTLR3::Template::GroupFile::Lexer) or require 'antlr3/template/group-file'
662
662
  ANTLR3::Template::GroupFile::Parser.main( ARGV )
663
663
 
664
664
  # - - - - - - end action @parser::main - - - - - - -
665
665
 
666
- end
666
+ end
@@ -3,7 +3,7 @@
3
3
 
4
4
  =begin ::about::
5
5
  author: Kyle Yetter <kcy5b@yahoo.com>
6
- created on: March 19, 2010
6
+ created on: March 19, 2011
7
7
  purpose: Loads the ANTLR recognition code for ANTLR Template Group files
8
8
  =end
9
9
 
data/lib/antlr3/token.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
data/lib/antlr3/tree.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
@@ -4,7 +4,7 @@
4
4
  =begin LICENSE
5
5
 
6
6
  [The "BSD licence"]
7
- Copyright (c) 2009-2010 Kyle Yetter
7
+ Copyright (c) 2009-2011 Kyle Yetter
8
8
  All rights reserved.
9
9
 
10
10
  Redistribution and use in source and binary forms, with or without
@@ -20,7 +20,7 @@ module ANTLR3
20
20
  #
21
21
  MAJOR_VERSION = 1
22
22
  MINOR_VERSION = 8
23
- PATCH_VERSION = 10
23
+ PATCH_VERSION = 11
24
24
  VERSION = [ MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION ]
25
25
  VERSION_STRING = VERSION.join( '.' ).freeze
26
26
 
data/templates/Ruby.stg CHANGED
@@ -1459,4 +1459,4 @@ placeAction(scope, name) ::= <<
1459
1459
  <endif>
1460
1460
  >>
1461
1461
 
1462
- runtimeLibraryVersion() ::= "1.8.10"
1462
+ runtimeLibraryVersion() ::= "1.8.11"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antlr3
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- - 10
10
- version: 1.8.10
9
+ - 11
10
+ version: 1.8.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kyle Yetter
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-28 00:00:00 -04:00
18
+ date: 2011-03-31 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21