Changeset 095b07b2b451c60d2ee5029942e6a0424a88a5c4
- Timestamp:
- 05/20/2008 03:08:17 PM
(8 months ago)
- Author:
- mitchell <mitchell@frost.(none)>
- git-committer:
- mitchell <mitchell@frost.(none)> 1211321297 -0400
- git-parent:
[27ac54a0b34218f9772e511aae8c5245a0aa83bb]
- git-author:
- mitchell <mitchell@frost.(none)> 1211321297 -0400
- Message:
Updated PARSER_DOC to include non-conflicting constant names.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| ra53b705 |
r095b07b |
|
| 22 | 22 | |
|---|
| 23 | 23 | // the name of the language |
|---|
| 24 | | const char *LANG = "c"; |
|---|
| | 24 | const char *C_LANG = "c"; |
|---|
| 25 | 25 | |
|---|
| 26 | 26 | // the languages entities |
|---|
| 27 | 27 | const char *c_entities[] = { |
|---|
| 28 | 28 | "space", "comment", "string", "number", "preproc", "keyword", |
|---|
| 29 | | "identifier", "operator", "escaped_newline", "newline", "any" |
|---|
| | 29 | "identifier", "operator", "escaped_newline", "newline" |
|---|
| 30 | 30 | }; |
|---|
| 31 | 31 | |
|---|
| 32 | 32 | // constants associated with the entities |
|---|
| 33 | 33 | enum { |
|---|
| 34 | | SPACE = 0, COMMENT, STRING, NUMBER, PREPROC, KEYWORD, |
|---|
| 35 | | IDENTIFIER, OPERATOR, ESCAPED_NL, NEWLINE, ANY |
|---|
| | 34 | C_SPACE = 0, C_COMMENT, C_STRING, C_NUMBER, C_PREPROC, C_KEYWORD, |
|---|
| | 35 | C_IDENTIFIER, C_OPERATOR, C_ESCAPED_NL, C_NEWLINE |
|---|
| 36 | 36 | }; |
|---|
| 37 | 37 | |
|---|
| … | … | |
| 100 | 100 | |
|---|
| 101 | 101 | The code can be found in the existing c.rl parser. You'll need to change: |
|---|
| 102 | | * LANG - Set the value of LANG to be the name of your language to parse. |
|---|
| 103 | | * [lang]_entities - Set the variable name to be [lang]_entities where [lang] |
|---|
| 104 | | is your language name. So if you're writing a C parser, it would be |
|---|
| 105 | | c_entities. The value is an array of string entities your language has. |
|---|
| | 102 | * [lang]_LANG - Set the variable name to be [lang]_LANG and its value to be |
|---|
| | 103 | the name of your language to parse. [lang] is your language name. So if |
|---|
| | 104 | you're writing a C parser, it would be C_LANG. |
|---|
| | 105 | * [lang]_entities - Set the variable name to be [lang]_entities (e.g. |
|---|
| | 106 | c_entries) The value is an array of string entities your language has. |
|---|
| 106 | 107 | For example C has comment, string, number, etc. entities. You should |
|---|
| 107 | | definately have "space", "newline", and "any" entities. If your language |
|---|
| 108 | | has escaped newlines (or continuations), have an "escaped_newline" entity |
|---|
| 109 | | as well. |
|---|
| | 108 | definately have "space", and "newline" entities. If your language has |
|---|
| | 109 | escaped newlines (or continuations), have an "escaped_newline" entity as |
|---|
| | 110 | well. |
|---|
| 110 | 111 | * enum - Change the value of the enum to correspond with your entities. So |
|---|
| 111 | 112 | if in your parser you look up [lang]_entities[ENTITY], you'll get the |
|---|