tripper 0.0.3d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/TODO +26 -0
- data/lib/generators/USAGE +8 -0
- data/lib/generators/tripper.rb +51 -0
- data/lib/generators/tripper/commonalities/commonalities.rb +226 -0
- data/lib/generators/tripper/detect_changes/detect_changes_generator.rb +173 -0
- data/lib/generators/tripper/detect_changes/model.rb +226 -0
- data/lib/generators/tripper/detect_changes/templates/migration.rb +7 -0
- data/lib/generators/tripper/detect_changes/templates/model/belongs_to.rb +1 -0
- data/lib/generators/tripper/detect_changes/templates/model/has_one.rb +1 -0
- data/lib/generators/tripper/detect_changes/templates/model/validates.rb +2 -0
- data/lib/generators/tripper/from_community/from_community_generator.rb +95 -0
- data/lib/generators/tripper/from_community/templates/actions/create.rb +8 -0
- data/lib/generators/tripper/from_community/templates/actions/destroy.rb +5 -0
- data/lib/generators/tripper/from_community/templates/actions/edit.rb +3 -0
- data/lib/generators/tripper/from_community/templates/actions/index.rb +3 -0
- data/lib/generators/tripper/from_community/templates/actions/new.rb +3 -0
- data/lib/generators/tripper/from_community/templates/actions/show.rb +3 -0
- data/lib/generators/tripper/from_community/templates/actions/update.rb +8 -0
- data/lib/generators/tripper/from_community/templates/controller.rb +3 -0
- data/lib/generators/tripper/from_community/templates/fixtures.yml +9 -0
- data/lib/generators/tripper/from_community/templates/helper.rb +2 -0
- data/lib/generators/tripper/from_community/templates/migration.rb +30 -0
- data/lib/generators/tripper/from_community/templates/model.rb +54 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/create.rb +11 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/destroy.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/edit.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/index.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/new.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/show.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/actions/update.rb +11 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/controller.rb +8 -0
- data/lib/generators/tripper/from_community/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/create.rb +13 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/edit.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/index.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/new.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/show.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/actions/update.rb +13 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/controller.rb +5 -0
- data/lib/generators/tripper/from_community/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/create.rb +11 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/destroy.rb +6 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/edit.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/index.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/new.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/show.rb +4 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/actions/update.rb +11 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/controller.rb +5 -0
- data/lib/generators/tripper/from_community/templates/tests/testunit/model.rb +7 -0
- data/lib/generators/tripper/from_community/templates/views/erb/_form.html.erb +16 -0
- data/lib/generators/tripper/from_community/templates/views/erb/edit.html.erb +14 -0
- data/lib/generators/tripper/from_community/templates/views/erb/index.html.erb +29 -0
- data/lib/generators/tripper/from_community/templates/views/erb/new.html.erb +7 -0
- data/lib/generators/tripper/from_community/templates/views/erb/show.html.erb +25 -0
- data/lib/generators/tripper/from_community/templates/views/haml/_form.html.haml +9 -0
- data/lib/generators/tripper/from_community/templates/views/haml/edit.html.haml +14 -0
- data/lib/generators/tripper/from_community/templates/views/haml/index.html.haml +25 -0
- data/lib/generators/tripper/from_community/templates/views/haml/new.html.haml +7 -0
- data/lib/generators/tripper/from_community/templates/views/haml/show.html.haml +20 -0
- data/lib/generators/tripper/layout/USAGE +18 -0
- data/lib/generators/tripper/layout/layout_generator.rb +29 -0
- data/lib/generators/tripper/layout/templates/error_messages_helper.rb +23 -0
- data/lib/generators/tripper/layout/templates/layout.html.erb +19 -0
- data/lib/generators/tripper/layout/templates/layout.html.haml +21 -0
- data/lib/generators/tripper/layout/templates/layout_helper.rb +22 -0
- data/lib/generators/tripper/layout/templates/stylesheet.css +83 -0
- data/lib/generators/tripper/layout/templates/stylesheet.sass +73 -0
- data/lib/generators/tripper/obj_constraint.rb +23 -0
- data/lib/generators/tripper/predicate.rb +12 -0
- data/lib/generators/tripper/sync_with_community/model.rb +260 -0
- data/lib/generators/tripper/sync_with_community/sync_with_community_generator.rb +310 -0
- data/lib/generators/tripper/sync_with_community/templates/migration.rb +7 -0
- data/lib/generators/tripper/sync_with_community/templates/model/belongs_to.rb +1 -0
- data/lib/generators/tripper/sync_with_community/templates/model/has_one.rb +1 -0
- data/lib/generators/tripper/sync_with_community/templates/model/validates.rb +2 -0
- data/lib/generators/tripper/templates/actions/create.rb +8 -0
- data/lib/generators/tripper/templates/actions/destroy.rb +5 -0
- data/lib/generators/tripper/templates/actions/edit.rb +3 -0
- data/lib/generators/tripper/templates/actions/index.rb +3 -0
- data/lib/generators/tripper/templates/actions/new.rb +3 -0
- data/lib/generators/tripper/templates/actions/show.rb +3 -0
- data/lib/generators/tripper/templates/actions/update.rb +8 -0
- data/lib/generators/tripper/templates/controller.rb +3 -0
- data/lib/generators/tripper/templates/fixtures.yml +9 -0
- data/lib/generators/tripper/templates/helper.rb +2 -0
- data/lib/generators/tripper/templates/migration.rb +30 -0
- data/lib/generators/tripper/templates/model.rb +54 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/create.rb +11 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/destroy.rb +6 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/edit.rb +4 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/index.rb +4 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/new.rb +4 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/show.rb +4 -0
- data/lib/generators/tripper/templates/tests/rspec/actions/update.rb +11 -0
- data/lib/generators/tripper/templates/tests/rspec/controller.rb +8 -0
- data/lib/generators/tripper/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/create.rb +13 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/edit.rb +6 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/index.rb +6 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/new.rb +6 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/show.rb +6 -0
- data/lib/generators/tripper/templates/tests/shoulda/actions/update.rb +13 -0
- data/lib/generators/tripper/templates/tests/shoulda/controller.rb +5 -0
- data/lib/generators/tripper/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/create.rb +11 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/destroy.rb +6 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/edit.rb +4 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/index.rb +4 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/new.rb +4 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/show.rb +4 -0
- data/lib/generators/tripper/templates/tests/testunit/actions/update.rb +11 -0
- data/lib/generators/tripper/templates/tests/testunit/controller.rb +5 -0
- data/lib/generators/tripper/templates/tests/testunit/model.rb +7 -0
- data/lib/generators/tripper/templates/views/erb/_form.html.erb +16 -0
- data/lib/generators/tripper/templates/views/erb/edit.html.erb +14 -0
- data/lib/generators/tripper/templates/views/erb/index.html.erb +29 -0
- data/lib/generators/tripper/templates/views/erb/new.html.erb +7 -0
- data/lib/generators/tripper/templates/views/erb/show.html.erb +25 -0
- data/lib/generators/tripper/templates/views/haml/_form.html.haml +9 -0
- data/lib/generators/tripper/templates/views/haml/edit.html.haml +14 -0
- data/lib/generators/tripper/templates/views/haml/index.html.haml +25 -0
- data/lib/generators/tripper/templates/views/haml/new.html.haml +7 -0
- data/lib/generators/tripper/templates/views/haml/show.html.haml +20 -0
- data/lib/tripper.rb +1 -0
- data/lib/tripper/GOSPLDB/config/database.yml +6 -0
- data/lib/tripper/GOSPLDB/config_db.rb +9 -0
- data/lib/tripper/GOSPLDB/console +2 -0
- data/lib/tripper/GOSPLDB/gospl_db_classes.rb +343 -0
- data/lib/tripper/GOSPLDB/play_around.rb +4 -0
- data/lib/tripper/GOSPLDB/rakefile.rb +88 -0
- data/lib/tripper/GOSPLDBToORMDB/gospl_db_to_orm_db.rb +88 -0
- data/lib/tripper/ORMDB/config/database.yml +6 -0
- data/lib/tripper/ORMDB/config_db.rb +9 -0
- data/lib/tripper/ORMDB/console +2 -0
- data/lib/tripper/ORMDB/db/migrations/0_create_orm_object_table.rb +17 -0
- data/lib/tripper/ORMDB/db/migrations/10_create_no_lot_constraint_table.rb +17 -0
- data/lib/tripper/ORMDB/db/migrations/11_create_value_constraint_table.rb +14 -0
- data/lib/tripper/ORMDB/db/migrations/12_create_value_constraint_value_table.rb +16 -0
- data/lib/tripper/ORMDB/db/migrations/13_create_value_range_table.rb +15 -0
- data/lib/tripper/ORMDB/db/migrations/14_create_frequency_constraint_table.rb +16 -0
- data/lib/tripper/ORMDB/db/migrations/15_create_value_table.rb +15 -0
- data/lib/tripper/ORMDB/db/migrations/16_create_ring_constraint_table.rb +14 -0
- data/lib/tripper/ORMDB/db/migrations/17_create_orm_schema_table.rb +21 -0
- data/lib/tripper/ORMDB/db/migrations/18_create_uniqueness_constraint_table.rb +15 -0
- data/lib/tripper/ORMDB/db/migrations/1_create_no_lot_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/2_create_lot_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/3_create_object_role_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/4_create_reference_table.rb +17 -0
- data/lib/tripper/ORMDB/db/migrations/5_create_predicate_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/6_create_object_role_constraint_table.rb +18 -0
- data/lib/tripper/ORMDB/db/migrations/7_create_subtype_table.rb +17 -0
- data/lib/tripper/ORMDB/db/migrations/8_create_mandatory_constraint_table.rb +15 -0
- data/lib/tripper/ORMDB/db/migrations/9_create_constraint_table.rb +15 -0
- data/lib/tripper/ORMDB/db/orm_ml.sqlite3 +0 -0
- data/lib/tripper/ORMDB/db/orm_ml.sqlite3.backup +0 -0
- data/lib/tripper/ORMDB/db/orm_ml.sqlite3.juli28-2013 +0 -0
- data/lib/tripper/ORMDB/db/orm_ml.sqlite3.old +0 -0
- data/lib/tripper/ORMDB/db/schema.rb +58 -0
- data/lib/tripper/ORMDB/erd.pdf +0 -0
- data/lib/tripper/ORMDB/migrate_db.rb +21 -0
- data/lib/tripper/ORMDB/orm_db_classes.rb +423 -0
- data/lib/tripper/ORMDB/populate.rb +4 -0
- data/lib/tripper/ORMDB/rakefile.rb +88 -0
- data/lib/tripper/model_parsers/attribute_parser/AttributeParser.g +50 -0
- data/lib/tripper/model_parsers/attribute_parser/AttributeParser.tokens +13 -0
- data/lib/tripper/model_parsers/attribute_parser/AttributeParserLexer.rb +538 -0
- data/lib/tripper/model_parsers/attribute_parser/AttributeParserParser.rb +412 -0
- data/lib/tripper/model_parsers/attribute_parser/playing_around.rb +14 -0
- data/lib/tripper/model_parsers/belongs_to/BelongsToParser.g +63 -0
- data/lib/tripper/model_parsers/belongs_to/BelongsToParser.tokens +21 -0
- data/lib/tripper/model_parsers/belongs_to/BelongsToParserLexer.rb +667 -0
- data/lib/tripper/model_parsers/belongs_to/BelongsToParserParser.rb +552 -0
- data/lib/tripper/model_parsers/belongs_to/playing_around.rb +9 -0
- data/lib/tripper/model_parsers/database_fields_parser/DatabaseFieldsParser.g +47 -0
- data/lib/tripper/model_parsers/database_fields_parser/DatabaseFieldsParser.tokens +14 -0
- data/lib/tripper/model_parsers/database_fields_parser/DatabaseFieldsParserLexer.rb +513 -0
- data/lib/tripper/model_parsers/database_fields_parser/DatabaseFieldsParserParser.rb +279 -0
- data/lib/tripper/model_parsers/database_fields_parser/playing_around.rb +14 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/HasAndBelongsToManyParser.g +92 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/HasAndBelongsToManyParser.tokens +25 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/HasAndBelongsToManyParserLexer.rb +787 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/HasAndBelongsToManyParserParser.rb +1024 -0
- data/lib/tripper/model_parsers/has_and_belongs_to_many/playing_around.rb +9 -0
- data/lib/tripper/model_parsers/has_many/HasManyParser.g +77 -0
- data/lib/tripper/model_parsers/has_many/HasManyParser.tokens +23 -0
- data/lib/tripper/model_parsers/has_many/HasManyParserLexer.rb +710 -0
- data/lib/tripper/model_parsers/has_many/HasManyParserParser.rb +788 -0
- data/lib/tripper/model_parsers/has_many/playing_around.rb +9 -0
- data/lib/tripper/model_parsers/has_one/HasOneParser.g +63 -0
- data/lib/tripper/model_parsers/has_one/HasOneParser.tokens +21 -0
- data/lib/tripper/model_parsers/has_one/HasOneParserLexer.rb +664 -0
- data/lib/tripper/model_parsers/has_one/HasOneParserParser.rb +552 -0
- data/lib/tripper/model_parsers/has_one/playing_around.rb +9 -0
- data/lib/tripper/model_parsers/validates/ValidatesParser.g +68 -0
- data/lib/tripper/model_parsers/validates/ValidatesParser.tokens +35 -0
- data/lib/tripper/model_parsers/validates/ValidatesParserLexer.rb +899 -0
- data/lib/tripper/model_parsers/validates/ValidatesParserParser.rb +869 -0
- data/lib/tripper/model_parsers/validates/playing_around.rb +9 -0
- data/lib/tripper/rails.rb +8 -0
- data/lib/tripper/version.rb +3 -0
- data/tripper.gemspec +33 -0
- metadata +408 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require './HasManyParserParser'
|
|
2
|
+
require './HasManyParserLexer'
|
|
3
|
+
@input = ANTLR3::StringStream.new( "has_many :communities, class_name: 'Community', foreign_key: :community_id" )
|
|
4
|
+
@lexer = HasManyParser::Lexer.new(@input)
|
|
5
|
+
@tokens = ANTLR3::CommonTokenStream.new(@lexer)
|
|
6
|
+
@parser = HasManyParser::Parser.new(@tokens)
|
|
7
|
+
a= @parser.has_many
|
|
8
|
+
puts a
|
|
9
|
+
#belongs_to :community, :class_name => 'Community'
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
grammar HasOneParser;
|
|
2
|
+
|
|
3
|
+
options {
|
|
4
|
+
language = Ruby;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@header {
|
|
8
|
+
def strip_quotes str
|
|
9
|
+
return str[1,(str.length)-2]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
@@attribute = nil
|
|
13
|
+
@@class_name = nil
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@members {
|
|
17
|
+
attr_accessor :attribute, :class_name
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
comment: COMMENT;
|
|
21
|
+
|
|
22
|
+
has_one returns [expr]: ((c=COMMENT)* | 'has_one' attribute class_name? comment?)
|
|
23
|
+
{
|
|
24
|
+
$expr = {attribute: @attribute, class_name: @class_name} unless $c
|
|
25
|
+
}
|
|
26
|
+
;
|
|
27
|
+
|
|
28
|
+
class_name: ',' (class_name_old_syntax | class_name_new_syntax);
|
|
29
|
+
|
|
30
|
+
class_name_old_syntax: ':' 'class_name' '=>' class_name_word
|
|
31
|
+
;
|
|
32
|
+
|
|
33
|
+
class_name_word: (('\'' a=ATTRIBUTE '\'') | ('"' a=ATTRIBUTE '"') | (':' a=ATTRIBUTE))
|
|
34
|
+
{
|
|
35
|
+
@class_name = $a.text
|
|
36
|
+
}
|
|
37
|
+
;
|
|
38
|
+
|
|
39
|
+
class_name_new_syntax: 'class_name' ':' class_name_word;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
attribute: ('\'' a=ATTRIBUTE '\'') | ('"' a=ATTRIBUTE '"') | (':' a=ATTRIBUTE)
|
|
43
|
+
{
|
|
44
|
+
@attribute = $a.text
|
|
45
|
+
}
|
|
46
|
+
;
|
|
47
|
+
|
|
48
|
+
//string: STRING;
|
|
49
|
+
|
|
50
|
+
/*------------------------------------------------------------------
|
|
51
|
+
* LEXER RULES
|
|
52
|
+
*------------------------------------------------------------------*/
|
|
53
|
+
//LITERAL: (HC|LC)(HC|LC|'_')*;
|
|
54
|
+
ATTRIBUTE: (HC|LC)(HC|LC|DIGIT|'_')*;
|
|
55
|
+
//LITERAL: (HC|LC)(HC|LC|DIGIT|'_'|'-')*;
|
|
56
|
+
//NUMERICCONSTANT: ('-')? DIGIT+ ('.' DIGIT+)?;
|
|
57
|
+
//STRING: '\'' ACTUALSTRING '\'';
|
|
58
|
+
WHITESPACE: ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+ { $channel = HIDDEN; };
|
|
59
|
+
COMMENT: '#' ~('\n'|'\r')*;
|
|
60
|
+
fragment ACTUALSTRING: ~('\\'|'\'')*;
|
|
61
|
+
fragment DIGIT: '0'..'9';
|
|
62
|
+
fragment HC: 'A'..'Z';
|
|
63
|
+
fragment LC: 'a'..'z';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
ACTUALSTRING=10
|
|
2
|
+
T__16=16
|
|
3
|
+
HC=6
|
|
4
|
+
T__15=15
|
|
5
|
+
T__17=17
|
|
6
|
+
T__12=12
|
|
7
|
+
T__11=11
|
|
8
|
+
T__14=14
|
|
9
|
+
T__13=13
|
|
10
|
+
ATTRIBUTE=5
|
|
11
|
+
WHITESPACE=9
|
|
12
|
+
LC=7
|
|
13
|
+
DIGIT=8
|
|
14
|
+
COMMENT=4
|
|
15
|
+
'"'=17
|
|
16
|
+
':'=13
|
|
17
|
+
','=12
|
|
18
|
+
'=>'=15
|
|
19
|
+
'class_name'=14
|
|
20
|
+
'\''=16
|
|
21
|
+
'has_one'=11
|
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g
|
|
4
|
+
# --
|
|
5
|
+
# Generated using ANTLR version: 3.2.1-SNAPSHOT Jul 31, 2010 19:34:52
|
|
6
|
+
# Ruby runtime library version: 1.8.11
|
|
7
|
+
# Input grammar file: /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g
|
|
8
|
+
# Generated at: 2013-05-05 11:31:51
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
# ~~~> start load path setup
|
|
12
|
+
this_directory = File.expand_path( File.dirname( __FILE__ ) )
|
|
13
|
+
$LOAD_PATH.unshift( this_directory ) unless $LOAD_PATH.include?( this_directory )
|
|
14
|
+
|
|
15
|
+
antlr_load_failed = proc do
|
|
16
|
+
load_path = $LOAD_PATH.map { |dir| ' - ' << dir }.join( $/ )
|
|
17
|
+
raise LoadError, <<-END.strip!
|
|
18
|
+
|
|
19
|
+
Failed to load the ANTLR3 runtime library (version 1.8.11):
|
|
20
|
+
|
|
21
|
+
Ensure the library has been installed on your system and is available
|
|
22
|
+
on the load path. If rubygems is available on your system, this can
|
|
23
|
+
be done with the command:
|
|
24
|
+
|
|
25
|
+
gem install antlr3
|
|
26
|
+
|
|
27
|
+
Current load path:
|
|
28
|
+
#{ load_path }
|
|
29
|
+
|
|
30
|
+
END
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
defined?( ANTLR3 ) or begin
|
|
34
|
+
|
|
35
|
+
# 1: try to load the ruby antlr3 runtime library from the system path
|
|
36
|
+
require 'antlr3'
|
|
37
|
+
|
|
38
|
+
rescue LoadError
|
|
39
|
+
|
|
40
|
+
# 2: try to load rubygems if it isn't already loaded
|
|
41
|
+
defined?( Gem ) or begin
|
|
42
|
+
require 'rubygems'
|
|
43
|
+
rescue LoadError
|
|
44
|
+
antlr_load_failed.call
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# 3: try to activate the antlr3 gem
|
|
48
|
+
begin
|
|
49
|
+
Gem.activate( 'antlr3', '~> 1.8.11' )
|
|
50
|
+
rescue Gem::LoadError
|
|
51
|
+
antlr_load_failed.call
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
require 'antlr3'
|
|
55
|
+
|
|
56
|
+
end
|
|
57
|
+
# <~~~ end load path setup
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
module HasOneParser
|
|
61
|
+
# TokenData defines all of the token type integer values
|
|
62
|
+
# as constants, which will be included in all
|
|
63
|
+
# ANTLR-generated recognizers.
|
|
64
|
+
const_defined?( :TokenData ) or TokenData = ANTLR3::TokenScheme.new
|
|
65
|
+
|
|
66
|
+
module TokenData
|
|
67
|
+
|
|
68
|
+
# define the token constants
|
|
69
|
+
define_tokens( :ACTUALSTRING => 10, :T__16 => 16, :T__15 => 15, :HC => 6,
|
|
70
|
+
:T__17 => 17, :T__12 => 12, :T__11 => 11, :T__14 => 14,
|
|
71
|
+
:T__13 => 13, :ATTRIBUTE => 5, :LC => 7, :WHITESPACE => 9,
|
|
72
|
+
:DIGIT => 8, :COMMENT => 4, :EOF => -1 )
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class Lexer < ANTLR3::Lexer
|
|
78
|
+
@grammar_home = HasOneParser
|
|
79
|
+
include TokenData
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
begin
|
|
83
|
+
generated_using( "/Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g", "3.2.1-SNAPSHOT Jul 31, 2010 19:34:52", "1.8.11" )
|
|
84
|
+
rescue NoMethodError => error
|
|
85
|
+
# ignore
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
RULE_NAMES = [ "T__11", "T__12", "T__13", "T__14", "T__15", "T__16",
|
|
89
|
+
"T__17", "ATTRIBUTE", "WHITESPACE", "COMMENT", "ACTUALSTRING",
|
|
90
|
+
"DIGIT", "HC", "LC" ].freeze
|
|
91
|
+
RULE_METHODS = [ :t__11!, :t__12!, :t__13!, :t__14!, :t__15!, :t__16!,
|
|
92
|
+
:t__17!, :attribute!, :whitespace!, :comment!, :actualstring!,
|
|
93
|
+
:digit!, :hc!, :lc! ].freeze
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def initialize( input=nil, options = {} )
|
|
97
|
+
super( input, options )
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# - - - - - - - - - - - lexer rules - - - - - - - - - - - -
|
|
103
|
+
# lexer rule t__11! (T__11)
|
|
104
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
105
|
+
def t__11!
|
|
106
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
107
|
+
# trace_in( __method__, 1 )
|
|
108
|
+
|
|
109
|
+
type = T__11
|
|
110
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# - - - - main rule block - - - -
|
|
114
|
+
# at line 7:9: 'has_one'
|
|
115
|
+
match( "has_one" )
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@state.type = type
|
|
119
|
+
@state.channel = channel
|
|
120
|
+
|
|
121
|
+
ensure
|
|
122
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
123
|
+
# trace_out( __method__, 1 )
|
|
124
|
+
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# lexer rule t__12! (T__12)
|
|
128
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
129
|
+
def t__12!
|
|
130
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
131
|
+
# trace_in( __method__, 2 )
|
|
132
|
+
|
|
133
|
+
type = T__12
|
|
134
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
# - - - - main rule block - - - -
|
|
138
|
+
# at line 8:9: ','
|
|
139
|
+
match( 0x2c )
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@state.type = type
|
|
143
|
+
@state.channel = channel
|
|
144
|
+
|
|
145
|
+
ensure
|
|
146
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
147
|
+
# trace_out( __method__, 2 )
|
|
148
|
+
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# lexer rule t__13! (T__13)
|
|
152
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
153
|
+
def t__13!
|
|
154
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
155
|
+
# trace_in( __method__, 3 )
|
|
156
|
+
|
|
157
|
+
type = T__13
|
|
158
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
# - - - - main rule block - - - -
|
|
162
|
+
# at line 9:9: ':'
|
|
163
|
+
match( 0x3a )
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
@state.type = type
|
|
167
|
+
@state.channel = channel
|
|
168
|
+
|
|
169
|
+
ensure
|
|
170
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
171
|
+
# trace_out( __method__, 3 )
|
|
172
|
+
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# lexer rule t__14! (T__14)
|
|
176
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
177
|
+
def t__14!
|
|
178
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
179
|
+
# trace_in( __method__, 4 )
|
|
180
|
+
|
|
181
|
+
type = T__14
|
|
182
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
# - - - - main rule block - - - -
|
|
186
|
+
# at line 10:9: 'class_name'
|
|
187
|
+
match( "class_name" )
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
@state.type = type
|
|
191
|
+
@state.channel = channel
|
|
192
|
+
|
|
193
|
+
ensure
|
|
194
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
195
|
+
# trace_out( __method__, 4 )
|
|
196
|
+
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# lexer rule t__15! (T__15)
|
|
200
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
201
|
+
def t__15!
|
|
202
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
203
|
+
# trace_in( __method__, 5 )
|
|
204
|
+
|
|
205
|
+
type = T__15
|
|
206
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
# - - - - main rule block - - - -
|
|
210
|
+
# at line 11:9: '=>'
|
|
211
|
+
match( "=>" )
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
@state.type = type
|
|
215
|
+
@state.channel = channel
|
|
216
|
+
|
|
217
|
+
ensure
|
|
218
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
219
|
+
# trace_out( __method__, 5 )
|
|
220
|
+
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# lexer rule t__16! (T__16)
|
|
224
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
225
|
+
def t__16!
|
|
226
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
227
|
+
# trace_in( __method__, 6 )
|
|
228
|
+
|
|
229
|
+
type = T__16
|
|
230
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
# - - - - main rule block - - - -
|
|
234
|
+
# at line 12:9: '\\''
|
|
235
|
+
match( 0x27 )
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
@state.type = type
|
|
239
|
+
@state.channel = channel
|
|
240
|
+
|
|
241
|
+
ensure
|
|
242
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
243
|
+
# trace_out( __method__, 6 )
|
|
244
|
+
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# lexer rule t__17! (T__17)
|
|
248
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
249
|
+
def t__17!
|
|
250
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
251
|
+
# trace_in( __method__, 7 )
|
|
252
|
+
|
|
253
|
+
type = T__17
|
|
254
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
# - - - - main rule block - - - -
|
|
258
|
+
# at line 13:9: '\"'
|
|
259
|
+
match( 0x22 )
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
@state.type = type
|
|
263
|
+
@state.channel = channel
|
|
264
|
+
|
|
265
|
+
ensure
|
|
266
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
267
|
+
# trace_out( __method__, 7 )
|
|
268
|
+
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# lexer rule attribute! (ATTRIBUTE)
|
|
272
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
273
|
+
def attribute!
|
|
274
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
275
|
+
# trace_in( __method__, 8 )
|
|
276
|
+
|
|
277
|
+
type = ATTRIBUTE
|
|
278
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
# - - - - main rule block - - - -
|
|
282
|
+
# at line 54:12: ( HC | LC ) ( HC | LC | DIGIT | '_' )*
|
|
283
|
+
if @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek( 1 ).between?( 0x61, 0x7a )
|
|
284
|
+
@input.consume
|
|
285
|
+
else
|
|
286
|
+
mse = MismatchedSet( nil )
|
|
287
|
+
recover mse
|
|
288
|
+
raise mse
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
# at line 54:19: ( HC | LC | DIGIT | '_' )*
|
|
293
|
+
while true # decision 1
|
|
294
|
+
alt_1 = 2
|
|
295
|
+
look_1_0 = @input.peek( 1 )
|
|
296
|
+
|
|
297
|
+
if ( look_1_0.between?( 0x30, 0x39 ) || look_1_0.between?( 0x41, 0x5a ) || look_1_0 == 0x5f || look_1_0.between?( 0x61, 0x7a ) )
|
|
298
|
+
alt_1 = 1
|
|
299
|
+
|
|
300
|
+
end
|
|
301
|
+
case alt_1
|
|
302
|
+
when 1
|
|
303
|
+
# at line
|
|
304
|
+
if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )
|
|
305
|
+
@input.consume
|
|
306
|
+
else
|
|
307
|
+
mse = MismatchedSet( nil )
|
|
308
|
+
recover mse
|
|
309
|
+
raise mse
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
else
|
|
315
|
+
break # out of loop for decision 1
|
|
316
|
+
end
|
|
317
|
+
end # loop for decision 1
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
@state.type = type
|
|
321
|
+
@state.channel = channel
|
|
322
|
+
|
|
323
|
+
ensure
|
|
324
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
325
|
+
# trace_out( __method__, 8 )
|
|
326
|
+
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# lexer rule whitespace! (WHITESPACE)
|
|
330
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
331
|
+
def whitespace!
|
|
332
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
333
|
+
# trace_in( __method__, 9 )
|
|
334
|
+
|
|
335
|
+
type = WHITESPACE
|
|
336
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
# - - - - main rule block - - - -
|
|
340
|
+
# at line 58:13: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )+
|
|
341
|
+
# at file 58:13: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )+
|
|
342
|
+
match_count_2 = 0
|
|
343
|
+
while true
|
|
344
|
+
alt_2 = 2
|
|
345
|
+
look_2_0 = @input.peek( 1 )
|
|
346
|
+
|
|
347
|
+
if ( look_2_0.between?( 0x9, 0xa ) || look_2_0.between?( 0xc, 0xd ) || look_2_0 == 0x20 )
|
|
348
|
+
alt_2 = 1
|
|
349
|
+
|
|
350
|
+
end
|
|
351
|
+
case alt_2
|
|
352
|
+
when 1
|
|
353
|
+
# at line
|
|
354
|
+
if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek( 1 ).between?( 0xc, 0xd ) || @input.peek(1) == 0x20
|
|
355
|
+
@input.consume
|
|
356
|
+
else
|
|
357
|
+
mse = MismatchedSet( nil )
|
|
358
|
+
recover mse
|
|
359
|
+
raise mse
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
else
|
|
365
|
+
match_count_2 > 0 and break
|
|
366
|
+
eee = EarlyExit(2)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
raise eee
|
|
370
|
+
end
|
|
371
|
+
match_count_2 += 1
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# --> action
|
|
375
|
+
channel = HIDDEN;
|
|
376
|
+
# <-- action
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
@state.type = type
|
|
380
|
+
@state.channel = channel
|
|
381
|
+
|
|
382
|
+
ensure
|
|
383
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
384
|
+
# trace_out( __method__, 9 )
|
|
385
|
+
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
# lexer rule comment! (COMMENT)
|
|
389
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
390
|
+
def comment!
|
|
391
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
392
|
+
# trace_in( __method__, 10 )
|
|
393
|
+
|
|
394
|
+
type = COMMENT
|
|
395
|
+
channel = ANTLR3::DEFAULT_CHANNEL
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
# - - - - main rule block - - - -
|
|
399
|
+
# at line 59:10: '#' (~ ( '\\n' | '\\r' ) )*
|
|
400
|
+
match( 0x23 )
|
|
401
|
+
# at line 59:14: (~ ( '\\n' | '\\r' ) )*
|
|
402
|
+
while true # decision 3
|
|
403
|
+
alt_3 = 2
|
|
404
|
+
look_3_0 = @input.peek( 1 )
|
|
405
|
+
|
|
406
|
+
if ( look_3_0.between?( 0x0, 0x9 ) || look_3_0.between?( 0xb, 0xc ) || look_3_0.between?( 0xe, 0xffff ) )
|
|
407
|
+
alt_3 = 1
|
|
408
|
+
|
|
409
|
+
end
|
|
410
|
+
case alt_3
|
|
411
|
+
when 1
|
|
412
|
+
# at line 59:14: ~ ( '\\n' | '\\r' )
|
|
413
|
+
if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )
|
|
414
|
+
@input.consume
|
|
415
|
+
else
|
|
416
|
+
mse = MismatchedSet( nil )
|
|
417
|
+
recover mse
|
|
418
|
+
raise mse
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
else
|
|
424
|
+
break # out of loop for decision 3
|
|
425
|
+
end
|
|
426
|
+
end # loop for decision 3
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
@state.type = type
|
|
430
|
+
@state.channel = channel
|
|
431
|
+
|
|
432
|
+
ensure
|
|
433
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
434
|
+
# trace_out( __method__, 10 )
|
|
435
|
+
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
# lexer rule actualstring! (ACTUALSTRING)
|
|
439
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
440
|
+
def actualstring!
|
|
441
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
442
|
+
# trace_in( __method__, 11 )
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
# - - - - main rule block - - - -
|
|
446
|
+
# at line 60:24: (~ ( '\\\\' | '\\'' ) )*
|
|
447
|
+
# at line 60:24: (~ ( '\\\\' | '\\'' ) )*
|
|
448
|
+
while true # decision 4
|
|
449
|
+
alt_4 = 2
|
|
450
|
+
look_4_0 = @input.peek( 1 )
|
|
451
|
+
|
|
452
|
+
if ( look_4_0.between?( 0x0, 0x26 ) || look_4_0.between?( 0x28, 0x5b ) || look_4_0.between?( 0x5d, 0xffff ) )
|
|
453
|
+
alt_4 = 1
|
|
454
|
+
|
|
455
|
+
end
|
|
456
|
+
case alt_4
|
|
457
|
+
when 1
|
|
458
|
+
# at line 60:24: ~ ( '\\\\' | '\\'' )
|
|
459
|
+
if @input.peek( 1 ).between?( 0x0, 0x26 ) || @input.peek( 1 ).between?( 0x28, 0x5b ) || @input.peek( 1 ).between?( 0x5d, 0xff )
|
|
460
|
+
@input.consume
|
|
461
|
+
else
|
|
462
|
+
mse = MismatchedSet( nil )
|
|
463
|
+
recover mse
|
|
464
|
+
raise mse
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
else
|
|
470
|
+
break # out of loop for decision 4
|
|
471
|
+
end
|
|
472
|
+
end # loop for decision 4
|
|
473
|
+
|
|
474
|
+
ensure
|
|
475
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
476
|
+
# trace_out( __method__, 11 )
|
|
477
|
+
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
# lexer rule digit! (DIGIT)
|
|
481
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
482
|
+
def digit!
|
|
483
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
484
|
+
# trace_in( __method__, 12 )
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
# - - - - main rule block - - - -
|
|
488
|
+
# at line 61:17: '0' .. '9'
|
|
489
|
+
match_range( 0x30, 0x39 )
|
|
490
|
+
|
|
491
|
+
ensure
|
|
492
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
493
|
+
# trace_out( __method__, 12 )
|
|
494
|
+
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
# lexer rule hc! (HC)
|
|
498
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
499
|
+
def hc!
|
|
500
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
501
|
+
# trace_in( __method__, 13 )
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
# - - - - main rule block - - - -
|
|
505
|
+
# at line 62:14: 'A' .. 'Z'
|
|
506
|
+
match_range( 0x41, 0x5a )
|
|
507
|
+
|
|
508
|
+
ensure
|
|
509
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
510
|
+
# trace_out( __method__, 13 )
|
|
511
|
+
|
|
512
|
+
end
|
|
513
|
+
|
|
514
|
+
# lexer rule lc! (LC)
|
|
515
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
|
516
|
+
def lc!
|
|
517
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
518
|
+
# trace_in( __method__, 14 )
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
# - - - - main rule block - - - -
|
|
522
|
+
# at line 63:14: 'a' .. 'z'
|
|
523
|
+
match_range( 0x61, 0x7a )
|
|
524
|
+
|
|
525
|
+
ensure
|
|
526
|
+
# -> uncomment the next line to manually enable rule tracing
|
|
527
|
+
# trace_out( __method__, 14 )
|
|
528
|
+
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
# main rule used to study the input at the current position,
|
|
532
|
+
# and choose the proper lexer rule to call in order to
|
|
533
|
+
# fetch the next token
|
|
534
|
+
#
|
|
535
|
+
# usually, you don't make direct calls to this method,
|
|
536
|
+
# but instead use the next_token method, which will
|
|
537
|
+
# build and emit the actual next token
|
|
538
|
+
def token!
|
|
539
|
+
# at line 1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | ATTRIBUTE | WHITESPACE | COMMENT )
|
|
540
|
+
alt_5 = 10
|
|
541
|
+
alt_5 = @dfa5.predict( @input )
|
|
542
|
+
case alt_5
|
|
543
|
+
when 1
|
|
544
|
+
# at line 1:10: T__11
|
|
545
|
+
t__11!
|
|
546
|
+
|
|
547
|
+
when 2
|
|
548
|
+
# at line 1:16: T__12
|
|
549
|
+
t__12!
|
|
550
|
+
|
|
551
|
+
when 3
|
|
552
|
+
# at line 1:22: T__13
|
|
553
|
+
t__13!
|
|
554
|
+
|
|
555
|
+
when 4
|
|
556
|
+
# at line 1:28: T__14
|
|
557
|
+
t__14!
|
|
558
|
+
|
|
559
|
+
when 5
|
|
560
|
+
# at line 1:34: T__15
|
|
561
|
+
t__15!
|
|
562
|
+
|
|
563
|
+
when 6
|
|
564
|
+
# at line 1:40: T__16
|
|
565
|
+
t__16!
|
|
566
|
+
|
|
567
|
+
when 7
|
|
568
|
+
# at line 1:46: T__17
|
|
569
|
+
t__17!
|
|
570
|
+
|
|
571
|
+
when 8
|
|
572
|
+
# at line 1:52: ATTRIBUTE
|
|
573
|
+
attribute!
|
|
574
|
+
|
|
575
|
+
when 9
|
|
576
|
+
# at line 1:62: WHITESPACE
|
|
577
|
+
whitespace!
|
|
578
|
+
|
|
579
|
+
when 10
|
|
580
|
+
# at line 1:73: COMMENT
|
|
581
|
+
comment!
|
|
582
|
+
|
|
583
|
+
end
|
|
584
|
+
end
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
# - - - - - - - - - - DFA definitions - - - - - - - - - - -
|
|
588
|
+
class DFA5 < ANTLR3::DFA
|
|
589
|
+
EOT = unpack( 1, -1, 1, 8, 2, -1, 1, 8, 6, -1, 10, 8, 1, 23, 1, 8,
|
|
590
|
+
1, -1, 2, 8, 1, 27, 1, -1 )
|
|
591
|
+
EOF = unpack( 28, -1 )
|
|
592
|
+
MIN = unpack( 1, 9, 1, 97, 2, -1, 1, 108, 6, -1, 1, 115, 1, 97, 1,
|
|
593
|
+
95, 1, 115, 1, 111, 1, 115, 1, 110, 1, 95, 1, 101, 1,
|
|
594
|
+
110, 1, 48, 1, 97, 1, -1, 1, 109, 1, 101, 1, 48, 1,
|
|
595
|
+
-1 )
|
|
596
|
+
MAX = unpack( 1, 122, 1, 97, 2, -1, 1, 108, 6, -1, 1, 115, 1, 97,
|
|
597
|
+
1, 95, 1, 115, 1, 111, 1, 115, 1, 110, 1, 95, 1, 101,
|
|
598
|
+
1, 110, 1, 122, 1, 97, 1, -1, 1, 109, 1, 101, 1, 122,
|
|
599
|
+
1, -1 )
|
|
600
|
+
ACCEPT = unpack( 2, -1, 1, 2, 1, 3, 1, -1, 1, 5, 1, 6, 1, 7, 1, 8,
|
|
601
|
+
1, 9, 1, 10, 12, -1, 1, 1, 3, -1, 1, 4 )
|
|
602
|
+
SPECIAL = unpack( 28, -1 )
|
|
603
|
+
TRANSITION = [
|
|
604
|
+
unpack( 2, 9, 1, -1, 2, 9, 18, -1, 1, 9, 1, -1, 1, 7, 1, 10, 3,
|
|
605
|
+
-1, 1, 6, 4, -1, 1, 2, 13, -1, 1, 3, 2, -1, 1, 5, 3, -1,
|
|
606
|
+
26, 8, 6, -1, 2, 8, 1, 4, 4, 8, 1, 1, 18, 8 ),
|
|
607
|
+
unpack( 1, 11 ),
|
|
608
|
+
unpack( ),
|
|
609
|
+
unpack( ),
|
|
610
|
+
unpack( 1, 12 ),
|
|
611
|
+
unpack( ),
|
|
612
|
+
unpack( ),
|
|
613
|
+
unpack( ),
|
|
614
|
+
unpack( ),
|
|
615
|
+
unpack( ),
|
|
616
|
+
unpack( ),
|
|
617
|
+
unpack( 1, 13 ),
|
|
618
|
+
unpack( 1, 14 ),
|
|
619
|
+
unpack( 1, 15 ),
|
|
620
|
+
unpack( 1, 16 ),
|
|
621
|
+
unpack( 1, 17 ),
|
|
622
|
+
unpack( 1, 18 ),
|
|
623
|
+
unpack( 1, 19 ),
|
|
624
|
+
unpack( 1, 20 ),
|
|
625
|
+
unpack( 1, 21 ),
|
|
626
|
+
unpack( 1, 22 ),
|
|
627
|
+
unpack( 10, 8, 7, -1, 26, 8, 4, -1, 1, 8, 1, -1, 26, 8 ),
|
|
628
|
+
unpack( 1, 24 ),
|
|
629
|
+
unpack( ),
|
|
630
|
+
unpack( 1, 25 ),
|
|
631
|
+
unpack( 1, 26 ),
|
|
632
|
+
unpack( 10, 8, 7, -1, 26, 8, 4, -1, 1, 8, 1, -1, 26, 8 ),
|
|
633
|
+
unpack( )
|
|
634
|
+
].freeze
|
|
635
|
+
|
|
636
|
+
( 0 ... MIN.length ).zip( MIN, MAX ) do | i, a, z |
|
|
637
|
+
if a > 0 and z < 0
|
|
638
|
+
MAX[ i ] %= 0x10000
|
|
639
|
+
end
|
|
640
|
+
end
|
|
641
|
+
|
|
642
|
+
@decision = 5
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
def description
|
|
646
|
+
<<-'__dfa_description__'.strip!
|
|
647
|
+
1:1: Tokens : ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | ATTRIBUTE | WHITESPACE | COMMENT );
|
|
648
|
+
__dfa_description__
|
|
649
|
+
end
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
private
|
|
654
|
+
|
|
655
|
+
def initialize_dfas
|
|
656
|
+
super rescue nil
|
|
657
|
+
@dfa5 = DFA5.new( self, 5 )
|
|
658
|
+
|
|
659
|
+
end
|
|
660
|
+
end # class Lexer < ANTLR3::Lexer
|
|
661
|
+
|
|
662
|
+
at_exit { Lexer.main( ARGV ) } if __FILE__ == $0
|
|
663
|
+
end
|
|
664
|
+
|