Cface__CDefinitionScanner.st
changeset 6 ae25dce94003
parent 5 c110eef5b9ef
child 9 03c7a764d2be
equal deleted inserted replaced
5:c110eef5b9ef 6:ae25dce94003
    31 <file>                  :       [\w-_/] [\w-_/.]* ;
    31 <file>                  :       [\w-_/] [\w-_/.]* ;
    32 
    32 
    33 <comment>       :       \# [^\r\n]* ;
    33 <comment>       :       \# [^\r\n]* ;
    34 "
    34 "
    35 
    35 
    36     "Modified: / 09-07-2008 / 21:26:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
    36     "Modified: / 10-07-2008 / 19:55:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
    37 ! !
    37 ! !
    38 
    38 
    39 !CDefinitionScanner class methodsFor:'generated-initialization'!
    39 !CDefinitionScanner class methodsFor:'generated-initialization'!
    40 
    40 
    41 initializeKeywordMap
    41 initializeKeywordMap
    42     keywordMap := Dictionary new.
    42     keywordMap := Dictionary new.
    43     #( #(36 'argument' 13)
    43     #( #(36 'argument' 13)
    44      #(36 'array' 26)
    44      #(36 'array' 7)
    45      #(36 'char' 5)
    45      #(36 'char' 15)
    46      #(36 'const' 28)
    46      #(36 'const' 30)
    47      #(36 'double' 16)
    47      #(36 'double' 24)
    48      #(36 'enum' 20)
    48      #(36 'enum' 20)
    49      #(36 'field' 19)
    49      #(36 'field' 18)
    50      #(36 'float' 15)
    50      #(36 'float' 27)
    51      #(36 'function' 11)
    51      #(36 'function' 11)
    52      #(36 'int' 6)
    52      #(36 'int' 16)
    53      #(36 'long' 4)
    53      #(36 'long' 6)
    54      #(36 'return' 8)
    54      #(36 'return' 2)
    55      #(36 'short' 3)
    55      #(36 'short' 5)
    56      #(36 'signed' 1)
    56      #(36 'signed' 3)
    57      #(36 'struct' 32)
    57      #(36 'struct' 31)
    58      #(36 'typedef' 22)
    58      #(36 'typedef' 22)
    59      #(36 'union' 29)
    59      #(36 'union' 25)
    60      #(36 'unsigned' 2)
    60      #(36 'unsigned' 4)
    61      #(36 'value' 21)
    61      #(36 'value' 8)
    62      #(36 'void' 24)
    62      #(36 'void' 26)
    63      #(36 'wchar_t' 27)
    63      #(36 'wchar_t' 28)
    64      #(33 'argument' 13)
    64      #(33 'argument' 13)
    65      #(33 'array' 26)
    65      #(33 'array' 7)
    66      #(33 'char' 5)
    66      #(33 'char' 15)
    67      #(33 'const' 28)
    67      #(33 'const' 30)
    68      #(33 'double' 16)
    68      #(33 'double' 24)
    69      #(33 'enum' 20)
    69      #(33 'enum' 20)
    70      #(33 'field' 19)
    70      #(33 'field' 18)
    71      #(33 'float' 15)
    71      #(33 'float' 27)
    72      #(33 'function' 11)
    72      #(33 'function' 11)
    73      #(33 'int' 6)
    73      #(33 'int' 16)
    74      #(33 'long' 4)
    74      #(33 'long' 6)
    75      #(33 'return' 8)
    75      #(33 'return' 2)
    76      #(33 'short' 3)
    76      #(33 'short' 5)
    77      #(33 'signed' 1)
    77      #(33 'signed' 3)
    78      #(33 'struct' 32)
    78      #(33 'struct' 31)
    79      #(33 'typedef' 22)
    79      #(33 'typedef' 22)
    80      #(33 'union' 29)
    80      #(33 'union' 25)
    81      #(33 'unsigned' 2)
    81      #(33 'unsigned' 4)
    82      #(33 'value' 21)
    82      #(33 'value' 8)
    83      #(33 'void' 24)
    83      #(33 'void' 26)
    84      #(33 'wchar_t' 27) ) 
    84      #(33 'wchar_t' 28) ) 
    85             do:[:each | 
    85             do:[:each | 
    86                 (keywordMap at:each first ifAbsentPut:[ Dictionary new ]) at:(each at:2)
    86                 (keywordMap at:each first ifAbsentPut:[ Dictionary new ]) at:(each at:2)
    87                     put:each last
    87                     put:each last
    88             ].
    88             ].
    89     ^ keywordMap
    89     ^ keywordMap
    90 
    90 
    91     "Modified: / 09-07-2008 / 21:25:59 / Jan Vrany <vranyj1@fel.cvut.cz>"
    91     "Modified: / 10-07-2008 / 19:55:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
    92 ! !
    92 ! !
    93 
    93 
    94 !CDefinitionScanner methodsFor:'generated-scanner'!
    94 !CDefinitionScanner methodsFor:'generated-scanner'!
    95 
    95 
    96 scan1
    96 scan1
   108         ] whileTrue.
   108         ] whileTrue.
   109         ^ self reportLastMatch
   109         ^ self reportLastMatch
   110     ].
   110     ].
   111     ^ self reportLastMatch
   111     ^ self reportLastMatch
   112 
   112 
   113     "Modified: / 09-07-2008 / 21:26:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
   113     "Modified: / 10-07-2008 / 19:55:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
   114 !
   114 !
   115 
   115 
   116 scan2
   116 scan2
   117     [
   117     [
   118         self recordMatch:#( 34 36 ).
   118         self recordMatch:#( 34 36 ).
   147         ] whileTrue.
   147         ] whileTrue.
   148         ^ self reportLastMatch
   148         ^ self reportLastMatch
   149     ].
   149     ].
   150     ^ self reportLastMatch
   150     ^ self reportLastMatch
   151 
   151 
   152     "Modified: / 09-07-2008 / 21:26:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
   152     "Modified: / 10-07-2008 / 19:55:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
   153 !
   153 !
   154 
   154 
   155 scan3
   155 scan3
   156     [
   156     [
   157         self recordMatch:#( 31 33 ).
   157         self recordMatch:#( 31 33 ).
  1183                 or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  1183                 or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  1184         ] whileTrue.
  1184         ] whileTrue.
  1185         ^ self reportLastMatch
  1185         ^ self reportLastMatch
  1186     ].
  1186     ].
  1187     (currentCharacter == $@) ifTrue:[
  1187     (currentCharacter == $@) ifTrue:[
  1188         ^ self recordAndReportMatch:#( 18 ).
  1188         ^ self recordAndReportMatch:#( 21 ).
  1189     ].
  1189     ].
  1190     (currentCharacter == $e) ifTrue:[
  1190     (currentCharacter == $e) ifTrue:[
  1191         self recordMatch:#( 33 36 ).
  1191         self recordMatch:#( 33 36 ).
  1192         self step.
  1192         self step.
  1193         ((currentCharacter between:$0 and:$9) 
  1193         ((currentCharacter between:$0 and:$9) 
  1831                                                                         or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  1831                                                                         or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  1832                                                                 ] whileTrue.
  1832                                                                 ] whileTrue.
  1833                                                                 ^ self reportLastMatch
  1833                                                                 ^ self reportLastMatch
  1834                                                             ].
  1834                                                             ].
  1835                                                     (currentCharacter == $e) ifTrue:[
  1835                                                     (currentCharacter == $e) ifTrue:[
  1836                                                         self recordMatch:#( 7 36 ).
  1836                                                         self recordMatch:#( 1 36 ).
  1837                                                         self step.
  1837                                                         self step.
  1838                                                         (currentCharacter isLetterOrDigit 
  1838                                                         (currentCharacter isLetterOrDigit 
  1839                                                             or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ]) 
  1839                                                             or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ]) 
  1840                                                                 ifTrue:[
  1840                                                                 ifTrue:[
  1841                                                                     [
  1841                                                                     [
  2079                                                             or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  2079                                                             or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  2080                                                     ] whileTrue.
  2080                                                     ] whileTrue.
  2081                                                     ^ self reportLastMatch
  2081                                                     ^ self reportLastMatch
  2082                                                 ].
  2082                                                 ].
  2083                                         (currentCharacter == $o) ifTrue:[
  2083                                         (currentCharacter == $o) ifTrue:[
  2084                                             self recordMatch:#( 30 36 ).
  2084                                             self recordMatch:#( 32 36 ).
  2085                                             self step.
  2085                                             self step.
  2086                                             (currentCharacter isLetterOrDigit 
  2086                                             (currentCharacter isLetterOrDigit 
  2087                                                 or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ]) 
  2087                                                 or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ]) 
  2088                                                     ifTrue:[
  2088                                                     ifTrue:[
  2089                                                         [
  2089                                                         [
  2418                                                                             or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  2418                                                                             or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  2419                                                                     ] whileTrue.
  2419                                                                     ] whileTrue.
  2420                                                                     ^ self reportLastMatch
  2420                                                                     ^ self reportLastMatch
  2421                                                                 ].
  2421                                                                 ].
  2422                                                         (currentCharacter == $n) ifTrue:[
  2422                                                         (currentCharacter == $n) ifTrue:[
  2423                                                             self recordMatch:#( 31 36 ).
  2423                                                             self recordMatch:#( 29 36 ).
  2424                                                             self step.
  2424                                                             self step.
  2425                                                             (currentCharacter isLetterOrDigit 
  2425                                                             (currentCharacter isLetterOrDigit 
  2426                                                                 or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ]) 
  2426                                                                 or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ]) 
  2427                                                                     ifTrue:[
  2427                                                                     ifTrue:[
  2428                                                                         [
  2428                                                                         [
  3111                                                                         or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  3111                                                                         or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ])
  3112                                                                 ] whileTrue.
  3112                                                                 ] whileTrue.
  3113                                                                 ^ self reportLastMatch
  3113                                                                 ^ self reportLastMatch
  3114                                                             ].
  3114                                                             ].
  3115                                                     (currentCharacter == $n) ifTrue:[
  3115                                                     (currentCharacter == $n) ifTrue:[
  3116                                                         self recordMatch:#( 25 36 ).
  3116                                                         self recordMatch:#( 19 36 ).
  3117                                                         self step.
  3117                                                         self step.
  3118                                                         (currentCharacter isLetterOrDigit 
  3118                                                         (currentCharacter isLetterOrDigit 
  3119                                                             or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ]) 
  3119                                                             or:[ (currentCharacter between:$- and:$/) or:[ currentCharacter == $_ ] ]) 
  3120                                                                 ifTrue:[
  3120                                                                 ifTrue:[
  3121                                                                     [
  3121                                                                     [
  3152         ].
  3152         ].
  3153         ^ self reportLastMatch
  3153         ^ self reportLastMatch
  3154     ].
  3154     ].
  3155     ^ self reportLastMatch
  3155     ^ self reportLastMatch
  3156 
  3156 
  3157     "Modified: / 09-07-2008 / 21:26:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
  3157     "Modified: / 10-07-2008 / 19:55:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
  3158 ! !
  3158 ! !
  3159 
  3159 
  3160 !CDefinitionScanner methodsFor:'generated-tokens'!
  3160 !CDefinitionScanner methodsFor:'generated-tokens'!
  3161 
  3161 
  3162 emptySymbolTokenId
  3162 emptySymbolTokenId
  3163 	^63
  3163 	^63
  3164 
  3164 
  3165     "Modified: / 09-07-2008 / 21:26:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
  3165     "Modified: / 10-07-2008 / 19:55:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
  3166 !
  3166 !
  3167 
  3167 
  3168 errorTokenId
  3168 errorTokenId
  3169 	^64
  3169 	^64
  3170 
  3170 
  3171     "Modified: / 09-07-2008 / 21:26:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
  3171     "Modified: / 10-07-2008 / 19:55:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
  3172 ! !
  3172 ! !
  3173 
  3173 
  3174 !CDefinitionScanner class methodsFor:'documentation'!
  3174 !CDefinitionScanner class methodsFor:'documentation'!
  3175 
  3175 
  3176 version
  3176 version