Ignore:
Timestamp:
Oct 15, 2009, 7:28:12 AM (15 years ago)
Author:
Tatsukawa, Akimichi
Message:

refactoring scanner for regex

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/adl_parser/lib/parser.y

    r318 r320  
    165165
    166166#c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
    167 c_complex_object: c_complx_object_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
     167#c_complex_object: c_complx_object_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
     168c_complex_object: c_complx_object_head SYM_MATCHES Slash_code REGEXP_BODY Slash_code # added by akimichi
    168169  {
    169170    result = OpenEhr::AM::Archetype::ConstraintModel::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
     
    396397    result = c_attribute
    397398  }
    398   | c_attr_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
     399#  | c_attr_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
     400  | c_attr_head SYM_MATCHES Slash_code REGEXP_BODY Slash_code # added by akimichi
    399401  {
    400402    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEhr::AM::Archetype::ConstraintModel::C_ATTRIBUTE)}
     
    901903
    902904date_time_value: V_ISO8601_EXTENDED_DATE_TIME
     905  {
     906    @@logger.debug("V_ISO8601_EXTENDED_DATE_TIME: #{val[0]} at #{@filename}:#{@lineno}")
     907    result = val[0]
     908  }
    903909
    904910date_time_list_value: date_time_value Comma_code date_time_value
     
    971977  | SYM_EXISTS error
    972978  | relative_path SYM_MATCHES SYM_START_CBLOCK c_primitive SYM_END_CBLOCK
    973   | relative_path SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
     979#  | relative_path SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
     980  | relative_path SYM_MATCHES Slash_code REGEXP_BODY Slash_code # added by akimichi
    974981  | SYM_NOT boolean_leaf
    975982  | arithmetic_expression '=' arithmetic_expression
     
    12981305
    12991306###----------/* keywords */ ---------------------------------------------
    1300 @@adl_reserved = {
    1301     'archetype' => :SYM_ARCHETYPE,
    1302     'adl_version' => :SYM_ADL_VERSION,
    1303     'controlled' => :SYM_IS_CONTROLLED,
    1304     'specialize' => :SYM_SPECIALIZE,
    1305     'concept' => :SYM_CONCEPT,
    1306     'language' => :SYM_LANGUAGE,
    1307     'description' => :SYM_DESCRIPTION,
    1308     'definition' => :SYM_DEFINITION,
    1309     'invariant' => :SYM_INVARIANT,
    1310     'ontology' => :SYM_ONTOLOGY,
    1311     'matches' => :SYM_MATCHES,
    1312     'is_in' => :SYM_MATCHES,
    1313     'occurrences' => :SYM_OCCURRENCES,
    1314     'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE
    1315     'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE
    1316     'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY
    1317 }
    1318 
    1319 @@dadl_reserved = {
    1320   'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE
    1321   'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE
    1322   'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY
    1323 }
    1324 
    1325 @@cadl_reserved = {
    1326   'then' => :SYM_THEN, # [Tt][Hh][Ee][Nn]
    1327   'else' => :SYM_ELSE, # [Ee][Ll][Ss][Ee]
    1328   'and' => :SYM_AND, # [Aa][Nn][Dd]
    1329   'or' => :SYM_OR, # [Oo][Rr]
    1330   'xor' => :SYM_XOR, # [Xx][Oo][Rr]
    1331   'not' => :SYM_NOT, # [Nn][Oo][Tt]
    1332   'implies' => :SYM_IMPLIES, # [Ii][Mm][Pp][Ll][Ii][Ee][Ss]
    1333   'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE
    1334   'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE
    1335   'forall' => :SYM_FORALL, # [Ff][Oo][Rr][_][Aa][Ll][Ll]
    1336   'exists' => :SYM_EXISTS, # [Ee][Xx][Ii][Ss][Tt][Ss]
    1337   'existence' => :SYM_EXISTENCE, # [Ee][Xx][Iu][Ss][Tt][Ee][Nn][Cc][Ee]
    1338   'occurrences' => :SYM_OCCURRENCES, # [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss]
    1339   'cardinality' => :SYM_CARDINALITY, # [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy]
    1340   'ordered' => :SYM_ORDERED, # [Oo][Rr][Dd][Ee][Rr][Ee][Dd]
    1341   'unordered' => :SYM_UNORDERED, # [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd]
    1342   'unique' => :SYM_UNIQUE, # [Uu][Nn][Ii][Qq][Uu][Ee]
    1343   'matches' => :SYM_MATCHES, # [Mm][Aa][Tt][Cc][Hh][Ee][Ss]
    1344   'is_in' => :SYM_MATCHES, # [Ii][Ss][_][Ii][Nn]
    1345   'invariant' => :SYM_INVARIANT, # [Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt]
    1346   'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY
    1347   'use_node' => :SYM_USE_NODE, # [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee]
    1348   'use_archetype' => :SYM_ALLOW_ARCHETYPE, # [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
    1349   'allow_archetype' => :SYM_ALLOW_ARCHETYPE, # [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
    1350   'include' => :SYM_INCLUDE, # [Ii][Nn][Cc][Ll][Uu][Dd][Ee]
    1351   'exclude' => :SYM_EXCLUDE # [Ee][Xx][Cc][Ll][Uu][Dd][Ee]
    1352 }
     1307### @@adl_reserved = {
     1308###     'archetype' => :SYM_ARCHETYPE,
     1309###     'adl_version' => :SYM_ADL_VERSION,
     1310###     'controlled' => :SYM_IS_CONTROLLED,
     1311###     'specialize' => :SYM_SPECIALIZE,
     1312###     'concept' => :SYM_CONCEPT,
     1313###     'language' => :SYM_LANGUAGE,
     1314###     'description' => :SYM_DESCRIPTION,
     1315###     'definition' => :SYM_DEFINITION,
     1316###     'invariant' => :SYM_INVARIANT,
     1317###     'ontology' => :SYM_ONTOLOGY,
     1318###     'matches' => :SYM_MATCHES,
     1319###     'is_in' => :SYM_MATCHES,
     1320###     'occurrences' => :SYM_OCCURRENCES,
     1321###     'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE
     1322###     'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE
     1323###     'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY
     1324### }
     1325
     1326### @@dadl_reserved = {
     1327###   'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE
     1328###   'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE
     1329###   'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY
     1330### }
     1331
     1332### @@cadl_reserved = {
     1333###   'then' => :SYM_THEN, # [Tt][Hh][Ee][Nn]
     1334###   'else' => :SYM_ELSE, # [Ee][Ll][Ss][Ee]
     1335###   'and' => :SYM_AND, # [Aa][Nn][Dd]
     1336###   'or' => :SYM_OR, # [Oo][Rr]
     1337###   'xor' => :SYM_XOR, # [Xx][Oo][Rr]
     1338###   'not' => :SYM_NOT, # [Nn][Oo][Tt]
     1339###   'implies' => :SYM_IMPLIES, # [Ii][Mm][Pp][Ll][Ii][Ee][Ss]
     1340###   'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE
     1341###   'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE
     1342###   'forall' => :SYM_FORALL, # [Ff][Oo][Rr][_][Aa][Ll][Ll]
     1343###   'exists' => :SYM_EXISTS, # [Ee][Xx][Ii][Ss][Tt][Ss]
     1344###   'existence' => :SYM_EXISTENCE, # [Ee][Xx][Iu][Ss][Tt][Ee][Nn][Cc][Ee]
     1345###   'occurrences' => :SYM_OCCURRENCES, # [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss]
     1346###   'cardinality' => :SYM_CARDINALITY, # [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy]
     1347###   'ordered' => :SYM_ORDERED, # [Oo][Rr][Dd][Ee][Rr][Ee][Dd]
     1348###   'unordered' => :SYM_UNORDERED, # [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd]
     1349###   'unique' => :SYM_UNIQUE, # [Uu][Nn][Ii][Qq][Uu][Ee]
     1350###   'matches' => :SYM_MATCHES, # [Mm][Aa][Tt][Cc][Hh][Ee][Ss]
     1351###   'is_in' => :SYM_MATCHES, # [Ii][Ss][_][Ii][Nn]
     1352###   'invariant' => :SYM_INVARIANT, # [Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt]
     1353###   'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY
     1354###   'use_node' => :SYM_USE_NODE, # [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee]
     1355###   'use_archetype' => :SYM_ALLOW_ARCHETYPE, # [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
     1356###   'allow_archetype' => :SYM_ALLOW_ARCHETYPE, # [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
     1357###   'include' => :SYM_INCLUDE, # [Ii][Nn][Cc][Ll][Uu][Dd][Ee]
     1358###   'exclude' => :SYM_EXCLUDE # [Ee][Xx][Cc][Ll][Uu][Dd][Ee]
     1359### }
    13531360
    13541361
Note: See TracChangeset for help on using the changeset viewer.