Changeset 35291 in osm for applications/editors/josm/plugins/comfort0/src
- Timestamp:
- 2020-01-13T21:45:35+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/comfort0/src/net/simon04/comfort0/level0l/Level0LParser.jj
r35290 r35291 1 1 options { 2 2 STATIC = false; 3 OUTPUT_DIRECTORY = "parsergen";4 3 } 5 4 … … 15 14 16 15 <DEFAULT> //HEADER 17 SKIP: { " " }18 19 <DEFAULT> //HEADER20 16 TOKEN: { 21 < H_EOL: ("\n" | "\r" | "\r\n") > : DATA22 | < H_ID: (["0"-"9"])+ >17 <EOL: ("\n" | "\r" | "\r\n") > 18 | <ID: (["0"-"9"])+ > 23 19 | <NODE: "node" > 24 20 | <WAY: "way" > 25 21 | <RELATION: "relation" > 22 | <WY: "wy" > 23 | <ND: "nd" > 24 | <REL: "rel" > 25 | <EQ: "=" > : VALUE 26 | <IDENT: ["a"-"z", "A"-"Z", "_"] (["a"-"z", "A"-"Z", "_", ":", "-", "0"-"9"])* > 26 27 | <FLOAT: ("+" | "-")? (["0"-"9"])+ ("." (["0"-"9"])+)? > 27 28 | <COLON: ":" > 28 29 | <COMMA: "," > 30 | <WHITESPACE: ([" ", "\t"])+ > 29 31 | <COMMENT_START: "#"> : COMMENT 30 32 } … … 35 37 <COMMENT> 36 38 TOKEN: { 37 <C_EOL: ("\n" | "\r" | "\r\n") > : DATA 38 } 39 40 <DATA> 41 TOKEN: { 42 <D_EOL: ("\n" | "\r" | "\r\n") > 43 | <D_SPACE: " " > 44 | <D_ID: (["0"-"9"])+ > 45 | <WY: "wy" > 46 | <ND: "nd" > 47 | <REL: "rel" > 48 | <EQ: "=" > : VALUE 49 | <IDENT: ["a"-"z", "A"-"Z", "_"] (["a"-"z", "A"-"Z", "_", "-", "0"-"9"])* > 50 | <D_COMMENT_START: "#"> : COMMENT 39 <C_EOL: ("\n" | "\r" | "\r\n") > : DEFAULT 51 40 } 52 41 53 42 <VALUE> 54 43 TOKEN: { 55 <V_EOL: ("\n" | "\r" | "\r\n") > : D ATA44 <V_EOL: ("\n" | "\r" | "\r\n") > : DEFAULT 56 45 | <TEXT: (~["\n", "\r"])+ > 57 46 } … … 64 53 { 65 54 ( 66 ( p = node() | p = way() | p = relation())55 p = node() 67 56 { primitives.add(p); } 57 | 58 p = way() 59 { primitives.add(p); } 60 | 61 p = relation() 62 { primitives.add(p); } 63 | 64 <COMMENT_START> <C_EOL> | <EOL> 68 65 )* 69 66 <EOF> … … 79 76 <NODE> 80 77 { r = new NodeData(); } 81 id=<H_ID> 78 ( <WHITESPACE> )+ 79 id=<ID> 82 80 { r.setId(Long.parseLong(id.image)); } 81 ( <WHITESPACE> )* 83 82 <COLON> 83 ( <WHITESPACE> )* 84 84 lat=<FLOAT> 85 ( <WHITESPACE> )* 85 86 <COMMA> 87 ( <WHITESPACE> )* 86 88 lon=<FLOAT> 87 89 { r.setCoor(new LatLon(Double.parseDouble(lat.image), Double.parseDouble(lon.image))); } 88 ( <COMMENT_START> <C_EOL> | <H_EOL> ) 89 ( <D_SPACE> <D_SPACE> tag(r) )* 90 ( <WHITESPACE> )* 91 ( <COMMENT_START> <C_EOL> | <EOL> ) 92 ( tag(r) )* 90 93 { return r; } 91 94 } … … 98 101 { 99 102 <WAY> 103 ( <WHITESPACE> )+ 100 104 { r = new WayData(); } 101 id=< H_ID>105 id=<ID> 102 106 { r.setId(Long.parseLong(id.image)); } 103 ( <COMMENT_START> <C_EOL> | <H_EOL> ) 107 ( <WHITESPACE> )* 108 ( <COMMENT_START> <C_EOL> | <EOL> ) 104 109 way_data(r) 105 110 { return r; } … … 113 118 { 114 119 <RELATION> 120 ( <WHITESPACE> )+ 115 121 { r = new RelationData(); } 116 id=< H_ID>122 id=<ID> 117 123 { r.setId(Long.parseLong(id.image)); } 118 ( <COMMENT_START> <C_EOL> | <H_EOL> ) 124 ( <WHITESPACE> )* 125 ( <COMMENT_START> <C_EOL> | <EOL> ) 119 126 relation_data(r) 120 127 { return r; } … … 124 131 {} 125 132 { 126 ( 127 <D_SPACE> <D_SPACE> 128 ( way_node(r) | tag(r) ) 129 )* 133 ( LOOKAHEAD(3) way_node(r) | tag(r) )* 130 134 } 131 135 … … 135 139 } 136 140 { 141 ( <WHITESPACE> )+ 137 142 <ND> 138 ( < D_SPACE> )+139 id=< D_ID>143 ( <WHITESPACE> )+ 144 id=<ID> 140 145 { r.getNodeIds().add(Long.parseLong(id.image)); } 141 ( < D_SPACE> )*142 ( < D_COMMENT_START> <C_EOL> | <D_EOL> )146 ( <WHITESPACE> )* 147 ( <COMMENT_START> <C_EOL> | <EOL> ) 143 148 } 144 149 … … 146 151 {} 147 152 { 148 ( 149 <D_SPACE> <D_SPACE> 150 ( relation_member(r) | tag(r) ) 151 )* 153 ( LOOKAHEAD(3) relation_member(r) | tag(r) )* 152 154 } 153 155 … … 159 161 } 160 162 { 163 ( <WHITESPACE> )+ 161 164 ( 162 165 <ND> { type = OsmPrimitiveType.NODE; } … … 166 169 <REL> { type = OsmPrimitiveType.RELATION; } 167 170 ) 168 <D_SPACE>169 id=< D_ID>171 ( <WHITESPACE> )+ 172 id=<ID> 170 173 ( 171 <D_SPACE> 172 ( 173 role=<IDENT> ( <D_SPACE> )* 174 | 175 ( <D_SPACE> )* 176 ) 174 LOOKAHEAD(2) 175 ( <WHITESPACE> )+ 176 role=<IDENT> 177 177 )? 178 178 { r.getMembers().add(new RelationMemberData(role != null ? role.image : "", type, Long.parseLong(id.image))); } 179 ( <D_COMMENT_START> <C_EOL> | <D_EOL> ) 179 ( <WHITESPACE> )* 180 ( <COMMENT_START> <C_EOL> | <EOL> ) 180 181 } 181 182 … … 185 186 } 186 187 { 188 ( <WHITESPACE> )+ 187 189 k=<IDENT> 188 ( < D_SPACE> )*190 ( <WHITESPACE> )* 189 191 <EQ> 192 ( <WHITESPACE> )* 190 193 v=<TEXT> 191 194 <V_EOL>
Note:
See TracChangeset
for help on using the changeset viewer.