tripper 0.0.3d
Sign up to get free protection for your applications and to get access to all the features.
- 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,552 @@
|
|
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
|
+
# - - - - - - begin action @parser::header - - - - - -
|
60
|
+
# /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g
|
61
|
+
|
62
|
+
|
63
|
+
def strip_quotes str
|
64
|
+
return str[1,(str.length)-2]
|
65
|
+
end
|
66
|
+
|
67
|
+
@@attribute = nil
|
68
|
+
@@class_name = nil
|
69
|
+
|
70
|
+
# - - - - - - end action @parser::header - - - - - - -
|
71
|
+
|
72
|
+
|
73
|
+
module HasOneParser
|
74
|
+
# TokenData defines all of the token type integer values
|
75
|
+
# as constants, which will be included in all
|
76
|
+
# ANTLR-generated recognizers.
|
77
|
+
const_defined?( :TokenData ) or TokenData = ANTLR3::TokenScheme.new
|
78
|
+
|
79
|
+
module TokenData
|
80
|
+
|
81
|
+
# define the token constants
|
82
|
+
define_tokens( :ACTUALSTRING => 10, :T__16 => 16, :HC => 6, :T__15 => 15,
|
83
|
+
:T__17 => 17, :T__12 => 12, :T__11 => 11, :T__14 => 14,
|
84
|
+
:T__13 => 13, :ATTRIBUTE => 5, :WHITESPACE => 9, :LC => 7,
|
85
|
+
:DIGIT => 8, :COMMENT => 4, :EOF => -1 )
|
86
|
+
|
87
|
+
# register the proper human-readable name or literal value
|
88
|
+
# for each token type
|
89
|
+
#
|
90
|
+
# this is necessary because anonymous tokens, which are
|
91
|
+
# created from literal values in the grammar, do not
|
92
|
+
# have descriptive names
|
93
|
+
register_names( "COMMENT", "ATTRIBUTE", "HC", "LC", "DIGIT", "WHITESPACE",
|
94
|
+
"ACTUALSTRING", "'has_one'", "','", "':'", "'class_name'",
|
95
|
+
"'=>'", "'\\''", "'\"'" )
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
class Parser < ANTLR3::Parser
|
101
|
+
@grammar_home = HasOneParser
|
102
|
+
|
103
|
+
RULE_METHODS = [ :comment, :has_one, :class_name, :class_name_old_syntax,
|
104
|
+
:class_name_word, :class_name_new_syntax, :attribute ].freeze
|
105
|
+
|
106
|
+
|
107
|
+
include TokenData
|
108
|
+
|
109
|
+
begin
|
110
|
+
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" )
|
111
|
+
rescue NoMethodError => error
|
112
|
+
# ignore
|
113
|
+
end
|
114
|
+
|
115
|
+
def initialize( input, options = {} )
|
116
|
+
super( input, options )
|
117
|
+
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
attr_accessor :attribute, :class_name
|
122
|
+
|
123
|
+
# - - - - - - - - - - - - Rules - - - - - - - - - - - - -
|
124
|
+
|
125
|
+
#
|
126
|
+
# parser rule comment
|
127
|
+
#
|
128
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
129
|
+
# 20:1: comment : COMMENT ;
|
130
|
+
#
|
131
|
+
def comment
|
132
|
+
# -> uncomment the next line to manually enable rule tracing
|
133
|
+
# trace_in( __method__, 1 )
|
134
|
+
|
135
|
+
begin
|
136
|
+
# at line 20:10: COMMENT
|
137
|
+
match( COMMENT, TOKENS_FOLLOWING_COMMENT_IN_comment_35 )
|
138
|
+
|
139
|
+
rescue ANTLR3::Error::RecognitionError => re
|
140
|
+
report_error(re)
|
141
|
+
recover(re)
|
142
|
+
|
143
|
+
ensure
|
144
|
+
# -> uncomment the next line to manually enable rule tracing
|
145
|
+
# trace_out( __method__, 1 )
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
return
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
#
|
154
|
+
# parser rule has_one
|
155
|
+
#
|
156
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
157
|
+
# 22:1: has_one returns [expr] : ( (c= COMMENT )* | 'has_one' attribute ( class_name )? ( comment )? ) ;
|
158
|
+
#
|
159
|
+
def has_one
|
160
|
+
# -> uncomment the next line to manually enable rule tracing
|
161
|
+
# trace_in( __method__, 2 )
|
162
|
+
expr = nil
|
163
|
+
c = nil
|
164
|
+
|
165
|
+
begin
|
166
|
+
# at line 22:25: ( (c= COMMENT )* | 'has_one' attribute ( class_name )? ( comment )? )
|
167
|
+
# at line 22:25: ( (c= COMMENT )* | 'has_one' attribute ( class_name )? ( comment )? )
|
168
|
+
alt_4 = 2
|
169
|
+
look_4_0 = @input.peek( 1 )
|
170
|
+
|
171
|
+
if ( look_4_0 == EOF || look_4_0 == COMMENT )
|
172
|
+
alt_4 = 1
|
173
|
+
elsif ( look_4_0 == T__11 )
|
174
|
+
alt_4 = 2
|
175
|
+
else
|
176
|
+
raise NoViableAlternative( "", 4, 0 )
|
177
|
+
end
|
178
|
+
case alt_4
|
179
|
+
when 1
|
180
|
+
# at line 22:26: (c= COMMENT )*
|
181
|
+
# at line 22:26: (c= COMMENT )*
|
182
|
+
while true # decision 1
|
183
|
+
alt_1 = 2
|
184
|
+
look_1_0 = @input.peek( 1 )
|
185
|
+
|
186
|
+
if ( look_1_0 == COMMENT )
|
187
|
+
alt_1 = 1
|
188
|
+
|
189
|
+
end
|
190
|
+
case alt_1
|
191
|
+
when 1
|
192
|
+
# at line 22:27: c= COMMENT
|
193
|
+
c = match( COMMENT, TOKENS_FOLLOWING_COMMENT_IN_has_one_50 )
|
194
|
+
|
195
|
+
else
|
196
|
+
break # out of loop for decision 1
|
197
|
+
end
|
198
|
+
end # loop for decision 1
|
199
|
+
|
200
|
+
when 2
|
201
|
+
# at line 22:41: 'has_one' attribute ( class_name )? ( comment )?
|
202
|
+
match( T__11, TOKENS_FOLLOWING_T__11_IN_has_one_56 )
|
203
|
+
@state.following.push( TOKENS_FOLLOWING_attribute_IN_has_one_58 )
|
204
|
+
attribute
|
205
|
+
@state.following.pop
|
206
|
+
# at line 22:61: ( class_name )?
|
207
|
+
alt_2 = 2
|
208
|
+
look_2_0 = @input.peek( 1 )
|
209
|
+
|
210
|
+
if ( look_2_0 == T__12 )
|
211
|
+
alt_2 = 1
|
212
|
+
end
|
213
|
+
case alt_2
|
214
|
+
when 1
|
215
|
+
# at line 22:61: class_name
|
216
|
+
@state.following.push( TOKENS_FOLLOWING_class_name_IN_has_one_60 )
|
217
|
+
class_name
|
218
|
+
@state.following.pop
|
219
|
+
|
220
|
+
end
|
221
|
+
# at line 22:73: ( comment )?
|
222
|
+
alt_3 = 2
|
223
|
+
look_3_0 = @input.peek( 1 )
|
224
|
+
|
225
|
+
if ( look_3_0 == COMMENT )
|
226
|
+
alt_3 = 1
|
227
|
+
end
|
228
|
+
case alt_3
|
229
|
+
when 1
|
230
|
+
# at line 22:73: comment
|
231
|
+
@state.following.push( TOKENS_FOLLOWING_comment_IN_has_one_63 )
|
232
|
+
comment
|
233
|
+
@state.following.pop
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
238
|
+
# --> action
|
239
|
+
|
240
|
+
expr = {attribute: @attribute, class_name: @class_name} unless c
|
241
|
+
|
242
|
+
# <-- action
|
243
|
+
|
244
|
+
rescue ANTLR3::Error::RecognitionError => re
|
245
|
+
report_error(re)
|
246
|
+
recover(re)
|
247
|
+
|
248
|
+
ensure
|
249
|
+
# -> uncomment the next line to manually enable rule tracing
|
250
|
+
# trace_out( __method__, 2 )
|
251
|
+
|
252
|
+
end
|
253
|
+
|
254
|
+
return expr
|
255
|
+
end
|
256
|
+
|
257
|
+
|
258
|
+
#
|
259
|
+
# parser rule class_name
|
260
|
+
#
|
261
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
262
|
+
# 28:1: class_name : ',' ( class_name_old_syntax | class_name_new_syntax ) ;
|
263
|
+
#
|
264
|
+
def class_name
|
265
|
+
# -> uncomment the next line to manually enable rule tracing
|
266
|
+
# trace_in( __method__, 3 )
|
267
|
+
|
268
|
+
begin
|
269
|
+
# at line 28:13: ',' ( class_name_old_syntax | class_name_new_syntax )
|
270
|
+
match( T__12, TOKENS_FOLLOWING_T__12_IN_class_name_76 )
|
271
|
+
# at line 28:17: ( class_name_old_syntax | class_name_new_syntax )
|
272
|
+
alt_5 = 2
|
273
|
+
look_5_0 = @input.peek( 1 )
|
274
|
+
|
275
|
+
if ( look_5_0 == T__13 )
|
276
|
+
alt_5 = 1
|
277
|
+
elsif ( look_5_0 == T__14 )
|
278
|
+
alt_5 = 2
|
279
|
+
else
|
280
|
+
raise NoViableAlternative( "", 5, 0 )
|
281
|
+
end
|
282
|
+
case alt_5
|
283
|
+
when 1
|
284
|
+
# at line 28:18: class_name_old_syntax
|
285
|
+
@state.following.push( TOKENS_FOLLOWING_class_name_old_syntax_IN_class_name_79 )
|
286
|
+
class_name_old_syntax
|
287
|
+
@state.following.pop
|
288
|
+
|
289
|
+
when 2
|
290
|
+
# at line 28:42: class_name_new_syntax
|
291
|
+
@state.following.push( TOKENS_FOLLOWING_class_name_new_syntax_IN_class_name_83 )
|
292
|
+
class_name_new_syntax
|
293
|
+
@state.following.pop
|
294
|
+
|
295
|
+
end
|
296
|
+
|
297
|
+
rescue ANTLR3::Error::RecognitionError => re
|
298
|
+
report_error(re)
|
299
|
+
recover(re)
|
300
|
+
|
301
|
+
ensure
|
302
|
+
# -> uncomment the next line to manually enable rule tracing
|
303
|
+
# trace_out( __method__, 3 )
|
304
|
+
|
305
|
+
end
|
306
|
+
|
307
|
+
return
|
308
|
+
end
|
309
|
+
|
310
|
+
|
311
|
+
#
|
312
|
+
# parser rule class_name_old_syntax
|
313
|
+
#
|
314
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
315
|
+
# 30:1: class_name_old_syntax : ':' 'class_name' '=>' class_name_word ;
|
316
|
+
#
|
317
|
+
def class_name_old_syntax
|
318
|
+
# -> uncomment the next line to manually enable rule tracing
|
319
|
+
# trace_in( __method__, 4 )
|
320
|
+
|
321
|
+
begin
|
322
|
+
# at line 30:24: ':' 'class_name' '=>' class_name_word
|
323
|
+
match( T__13, TOKENS_FOLLOWING_T__13_IN_class_name_old_syntax_91 )
|
324
|
+
match( T__14, TOKENS_FOLLOWING_T__14_IN_class_name_old_syntax_93 )
|
325
|
+
match( T__15, TOKENS_FOLLOWING_T__15_IN_class_name_old_syntax_95 )
|
326
|
+
@state.following.push( TOKENS_FOLLOWING_class_name_word_IN_class_name_old_syntax_97 )
|
327
|
+
class_name_word
|
328
|
+
@state.following.pop
|
329
|
+
|
330
|
+
rescue ANTLR3::Error::RecognitionError => re
|
331
|
+
report_error(re)
|
332
|
+
recover(re)
|
333
|
+
|
334
|
+
ensure
|
335
|
+
# -> uncomment the next line to manually enable rule tracing
|
336
|
+
# trace_out( __method__, 4 )
|
337
|
+
|
338
|
+
end
|
339
|
+
|
340
|
+
return
|
341
|
+
end
|
342
|
+
|
343
|
+
|
344
|
+
#
|
345
|
+
# parser rule class_name_word
|
346
|
+
#
|
347
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
348
|
+
# 33:1: class_name_word : ( ( '\\'' a= ATTRIBUTE '\\'' ) | ( '\"' a= ATTRIBUTE '\"' ) | ( ':' a= ATTRIBUTE ) ) ;
|
349
|
+
#
|
350
|
+
def class_name_word
|
351
|
+
# -> uncomment the next line to manually enable rule tracing
|
352
|
+
# trace_in( __method__, 5 )
|
353
|
+
a = nil
|
354
|
+
|
355
|
+
begin
|
356
|
+
# at line 33:18: ( ( '\\'' a= ATTRIBUTE '\\'' ) | ( '\"' a= ATTRIBUTE '\"' ) | ( ':' a= ATTRIBUTE ) )
|
357
|
+
# at line 33:18: ( ( '\\'' a= ATTRIBUTE '\\'' ) | ( '\"' a= ATTRIBUTE '\"' ) | ( ':' a= ATTRIBUTE ) )
|
358
|
+
alt_6 = 3
|
359
|
+
case look_6 = @input.peek( 1 )
|
360
|
+
when T__16 then alt_6 = 1
|
361
|
+
when T__17 then alt_6 = 2
|
362
|
+
when T__13 then alt_6 = 3
|
363
|
+
else
|
364
|
+
raise NoViableAlternative( "", 6, 0 )
|
365
|
+
end
|
366
|
+
case alt_6
|
367
|
+
when 1
|
368
|
+
# at line 33:19: ( '\\'' a= ATTRIBUTE '\\'' )
|
369
|
+
# at line 33:19: ( '\\'' a= ATTRIBUTE '\\'' )
|
370
|
+
# at line 33:20: '\\'' a= ATTRIBUTE '\\''
|
371
|
+
match( T__16, TOKENS_FOLLOWING_T__16_IN_class_name_word_107 )
|
372
|
+
a = match( ATTRIBUTE, TOKENS_FOLLOWING_ATTRIBUTE_IN_class_name_word_111 )
|
373
|
+
match( T__16, TOKENS_FOLLOWING_T__16_IN_class_name_word_113 )
|
374
|
+
|
375
|
+
|
376
|
+
when 2
|
377
|
+
# at line 33:45: ( '\"' a= ATTRIBUTE '\"' )
|
378
|
+
# at line 33:45: ( '\"' a= ATTRIBUTE '\"' )
|
379
|
+
# at line 33:46: '\"' a= ATTRIBUTE '\"'
|
380
|
+
match( T__17, TOKENS_FOLLOWING_T__17_IN_class_name_word_119 )
|
381
|
+
a = match( ATTRIBUTE, TOKENS_FOLLOWING_ATTRIBUTE_IN_class_name_word_123 )
|
382
|
+
match( T__17, TOKENS_FOLLOWING_T__17_IN_class_name_word_125 )
|
383
|
+
|
384
|
+
|
385
|
+
when 3
|
386
|
+
# at line 33:69: ( ':' a= ATTRIBUTE )
|
387
|
+
# at line 33:69: ( ':' a= ATTRIBUTE )
|
388
|
+
# at line 33:70: ':' a= ATTRIBUTE
|
389
|
+
match( T__13, TOKENS_FOLLOWING_T__13_IN_class_name_word_131 )
|
390
|
+
a = match( ATTRIBUTE, TOKENS_FOLLOWING_ATTRIBUTE_IN_class_name_word_135 )
|
391
|
+
|
392
|
+
|
393
|
+
end
|
394
|
+
# --> action
|
395
|
+
|
396
|
+
@class_name = a.text
|
397
|
+
|
398
|
+
# <-- action
|
399
|
+
|
400
|
+
rescue ANTLR3::Error::RecognitionError => re
|
401
|
+
report_error(re)
|
402
|
+
recover(re)
|
403
|
+
|
404
|
+
ensure
|
405
|
+
# -> uncomment the next line to manually enable rule tracing
|
406
|
+
# trace_out( __method__, 5 )
|
407
|
+
|
408
|
+
end
|
409
|
+
|
410
|
+
return
|
411
|
+
end
|
412
|
+
|
413
|
+
|
414
|
+
#
|
415
|
+
# parser rule class_name_new_syntax
|
416
|
+
#
|
417
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
418
|
+
# 39:1: class_name_new_syntax : 'class_name' ':' class_name_word ;
|
419
|
+
#
|
420
|
+
def class_name_new_syntax
|
421
|
+
# -> uncomment the next line to manually enable rule tracing
|
422
|
+
# trace_in( __method__, 6 )
|
423
|
+
|
424
|
+
begin
|
425
|
+
# at line 39:24: 'class_name' ':' class_name_word
|
426
|
+
match( T__14, TOKENS_FOLLOWING_T__14_IN_class_name_new_syntax_148 )
|
427
|
+
match( T__13, TOKENS_FOLLOWING_T__13_IN_class_name_new_syntax_150 )
|
428
|
+
@state.following.push( TOKENS_FOLLOWING_class_name_word_IN_class_name_new_syntax_152 )
|
429
|
+
class_name_word
|
430
|
+
@state.following.pop
|
431
|
+
|
432
|
+
rescue ANTLR3::Error::RecognitionError => re
|
433
|
+
report_error(re)
|
434
|
+
recover(re)
|
435
|
+
|
436
|
+
ensure
|
437
|
+
# -> uncomment the next line to manually enable rule tracing
|
438
|
+
# trace_out( __method__, 6 )
|
439
|
+
|
440
|
+
end
|
441
|
+
|
442
|
+
return
|
443
|
+
end
|
444
|
+
|
445
|
+
|
446
|
+
#
|
447
|
+
# parser rule attribute
|
448
|
+
#
|
449
|
+
# (in /Users/rivmeche/Google Drive/vub/_Thesis/code/tripper/lib/tripper/model_parsers/has_one/HasOneParser.g)
|
450
|
+
# 42:1: attribute : ( ( '\\'' a= ATTRIBUTE '\\'' ) | ( '\"' a= ATTRIBUTE '\"' ) | ( ':' a= ATTRIBUTE ) );
|
451
|
+
#
|
452
|
+
def attribute
|
453
|
+
# -> uncomment the next line to manually enable rule tracing
|
454
|
+
# trace_in( __method__, 7 )
|
455
|
+
a = nil
|
456
|
+
|
457
|
+
begin
|
458
|
+
# at line 42:10: ( ( '\\'' a= ATTRIBUTE '\\'' ) | ( '\"' a= ATTRIBUTE '\"' ) | ( ':' a= ATTRIBUTE ) )
|
459
|
+
alt_7 = 3
|
460
|
+
case look_7 = @input.peek( 1 )
|
461
|
+
when T__16 then alt_7 = 1
|
462
|
+
when T__17 then alt_7 = 2
|
463
|
+
when T__13 then alt_7 = 3
|
464
|
+
else
|
465
|
+
raise NoViableAlternative( "", 7, 0 )
|
466
|
+
end
|
467
|
+
case alt_7
|
468
|
+
when 1
|
469
|
+
# at line 42:12: ( '\\'' a= ATTRIBUTE '\\'' )
|
470
|
+
# at line 42:12: ( '\\'' a= ATTRIBUTE '\\'' )
|
471
|
+
# at line 42:13: '\\'' a= ATTRIBUTE '\\''
|
472
|
+
match( T__16, TOKENS_FOLLOWING_T__16_IN_attribute_161 )
|
473
|
+
a = match( ATTRIBUTE, TOKENS_FOLLOWING_ATTRIBUTE_IN_attribute_165 )
|
474
|
+
match( T__16, TOKENS_FOLLOWING_T__16_IN_attribute_167 )
|
475
|
+
|
476
|
+
|
477
|
+
when 2
|
478
|
+
# at line 42:38: ( '\"' a= ATTRIBUTE '\"' )
|
479
|
+
# at line 42:38: ( '\"' a= ATTRIBUTE '\"' )
|
480
|
+
# at line 42:39: '\"' a= ATTRIBUTE '\"'
|
481
|
+
match( T__17, TOKENS_FOLLOWING_T__17_IN_attribute_173 )
|
482
|
+
a = match( ATTRIBUTE, TOKENS_FOLLOWING_ATTRIBUTE_IN_attribute_177 )
|
483
|
+
match( T__17, TOKENS_FOLLOWING_T__17_IN_attribute_179 )
|
484
|
+
|
485
|
+
|
486
|
+
when 3
|
487
|
+
# at line 42:62: ( ':' a= ATTRIBUTE )
|
488
|
+
# at line 42:62: ( ':' a= ATTRIBUTE )
|
489
|
+
# at line 42:63: ':' a= ATTRIBUTE
|
490
|
+
match( T__13, TOKENS_FOLLOWING_T__13_IN_attribute_185 )
|
491
|
+
a = match( ATTRIBUTE, TOKENS_FOLLOWING_ATTRIBUTE_IN_attribute_189 )
|
492
|
+
|
493
|
+
# --> action
|
494
|
+
|
495
|
+
@attribute = a.text
|
496
|
+
|
497
|
+
# <-- action
|
498
|
+
|
499
|
+
end
|
500
|
+
rescue ANTLR3::Error::RecognitionError => re
|
501
|
+
report_error(re)
|
502
|
+
recover(re)
|
503
|
+
|
504
|
+
ensure
|
505
|
+
# -> uncomment the next line to manually enable rule tracing
|
506
|
+
# trace_out( __method__, 7 )
|
507
|
+
|
508
|
+
end
|
509
|
+
|
510
|
+
return
|
511
|
+
end
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
TOKENS_FOLLOWING_COMMENT_IN_comment_35 = Set[ 1 ]
|
516
|
+
TOKENS_FOLLOWING_COMMENT_IN_has_one_50 = Set[ 1, 4 ]
|
517
|
+
TOKENS_FOLLOWING_T__11_IN_has_one_56 = Set[ 13, 16, 17 ]
|
518
|
+
TOKENS_FOLLOWING_attribute_IN_has_one_58 = Set[ 1, 4, 12 ]
|
519
|
+
TOKENS_FOLLOWING_class_name_IN_has_one_60 = Set[ 1, 4 ]
|
520
|
+
TOKENS_FOLLOWING_comment_IN_has_one_63 = Set[ 1 ]
|
521
|
+
TOKENS_FOLLOWING_T__12_IN_class_name_76 = Set[ 13, 14 ]
|
522
|
+
TOKENS_FOLLOWING_class_name_old_syntax_IN_class_name_79 = Set[ 1 ]
|
523
|
+
TOKENS_FOLLOWING_class_name_new_syntax_IN_class_name_83 = Set[ 1 ]
|
524
|
+
TOKENS_FOLLOWING_T__13_IN_class_name_old_syntax_91 = Set[ 14 ]
|
525
|
+
TOKENS_FOLLOWING_T__14_IN_class_name_old_syntax_93 = Set[ 15 ]
|
526
|
+
TOKENS_FOLLOWING_T__15_IN_class_name_old_syntax_95 = Set[ 13, 16, 17 ]
|
527
|
+
TOKENS_FOLLOWING_class_name_word_IN_class_name_old_syntax_97 = Set[ 1 ]
|
528
|
+
TOKENS_FOLLOWING_T__16_IN_class_name_word_107 = Set[ 5 ]
|
529
|
+
TOKENS_FOLLOWING_ATTRIBUTE_IN_class_name_word_111 = Set[ 16 ]
|
530
|
+
TOKENS_FOLLOWING_T__16_IN_class_name_word_113 = Set[ 1 ]
|
531
|
+
TOKENS_FOLLOWING_T__17_IN_class_name_word_119 = Set[ 5 ]
|
532
|
+
TOKENS_FOLLOWING_ATTRIBUTE_IN_class_name_word_123 = Set[ 17 ]
|
533
|
+
TOKENS_FOLLOWING_T__17_IN_class_name_word_125 = Set[ 1 ]
|
534
|
+
TOKENS_FOLLOWING_T__13_IN_class_name_word_131 = Set[ 5 ]
|
535
|
+
TOKENS_FOLLOWING_ATTRIBUTE_IN_class_name_word_135 = Set[ 1 ]
|
536
|
+
TOKENS_FOLLOWING_T__14_IN_class_name_new_syntax_148 = Set[ 13 ]
|
537
|
+
TOKENS_FOLLOWING_T__13_IN_class_name_new_syntax_150 = Set[ 13, 16, 17 ]
|
538
|
+
TOKENS_FOLLOWING_class_name_word_IN_class_name_new_syntax_152 = Set[ 1 ]
|
539
|
+
TOKENS_FOLLOWING_T__16_IN_attribute_161 = Set[ 5 ]
|
540
|
+
TOKENS_FOLLOWING_ATTRIBUTE_IN_attribute_165 = Set[ 16 ]
|
541
|
+
TOKENS_FOLLOWING_T__16_IN_attribute_167 = Set[ 1 ]
|
542
|
+
TOKENS_FOLLOWING_T__17_IN_attribute_173 = Set[ 5 ]
|
543
|
+
TOKENS_FOLLOWING_ATTRIBUTE_IN_attribute_177 = Set[ 17 ]
|
544
|
+
TOKENS_FOLLOWING_T__17_IN_attribute_179 = Set[ 1 ]
|
545
|
+
TOKENS_FOLLOWING_T__13_IN_attribute_185 = Set[ 5 ]
|
546
|
+
TOKENS_FOLLOWING_ATTRIBUTE_IN_attribute_189 = Set[ 1 ]
|
547
|
+
|
548
|
+
end # class Parser < ANTLR3::Parser
|
549
|
+
|
550
|
+
at_exit { Parser.main( ARGV ) } if __FILE__ == $0
|
551
|
+
end
|
552
|
+
|