• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

programming language


Commit MetaInfo

Revisión24f89120c055fcf3496111f3118d1b84b29ba1f5 (tree)
Tiempo2023-01-10 23:13:28
Autordhrname <dhrname@joes...>
Commiterdhrname

Log Message

Modify the BNF array in the parser.hpp

Cambiar Resumen

Diferencia incremental

--- a/include/parser.hpp
+++ b/include/parser.hpp
@@ -219,7 +219,6 @@ namespace jstr
219219 /*modules_statement:
220220 IDENTIFIER
221221 prefix_class_list
222- COLON
223222 class_body
224223 modules_statement
225224 | INCLUDE
@@ -235,18 +234,17 @@ namespace jstr
235234 | <ε>*/
236235 {IDENTIFIER
237236 , prefix_class_list
238- , COLON
239237 , class_body
240- , modules_statement, 0}
238+ , modules_statement}
241239 ,{INCLUDE
242240 , IDENTIFIER
243241 , LINEEND
244- , modules_statement, 0, 0, 0, 0, 0, 0}
242+ , modules_statement}
245243 ,{MAIN
246244 , COLON
247245 , statement_list
248246 , LINEEND
249- , modules_statement, 0}
247+ , modules_statement}
250248 ,{END, 0, 0, 0, 0, 0, 0, 0, 0, 0}
251249 ,{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
252250 ,{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
@@ -258,11 +256,10 @@ namespace jstr
258256 }
259257 , {
260258 /*prefix_class_list: RATIONALLEFT, IDENTIFIER, prefix_class_list
261- | RATIONALLEFT, IDENTIFIER
262- | <ε>*/
259+ | COLON*/
263260 {RATIONALLEFT, IDENTIFIER, prefix_class_list}
264- ,{RATIONALLEFT, IDENTIFIER}
265- ,{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
261+ ,{COLON}
262+ ,{}
266263 ,{}
267264 ,{}
268265 ,{}
@@ -274,10 +271,11 @@ namespace jstr
274271 }
275272 , {
276273 /*class_body: declaration_list
274+ DEFINE
277275 arrow_list
278- | <ε>*/
279- {declaration_list, arrow_list}
280- ,{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
276+ LINEEND*/
277+ {declaration_list, DEFINE, arrow_list, LINEEND}
278+ ,{}
281279 ,{}
282280 ,{}
283281 ,{}
@@ -294,13 +292,11 @@ namespace jstr
294292 declaration
295293 LINEEND
296294 declaration_list
297- | DEFINE
298295 | <ε>*/
299296 {INDENT
300297 , declaration
301298 , LINEEND
302299 , declaration_list}
303- ,{DEFINE}
304300 ,{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
305301 ,{}
306302 ,{}
@@ -310,22 +306,27 @@ namespace jstr
310306 ,{}
311307 ,{}
312308 ,{}
309+ ,{}
313310 }
314311 , {
315312 /*arrow_list:
316313 INDENT
317- IDENTIFIER
314+ arrow_list
315+ | IDENTIFIER
318316 COLON
319317 statement_list
318+ DEDENT
319+ LINEEND
320320 arrow_list
321- | LINEEND
322321 | <ε>*/
323322 {INDENT
324- , IDENTIFIER
323+ , arrow_list}
324+ ,{IDENTIFIER
325325 , COLON
326326 , statement_list
327+ , DEDENT
328+ , LINEEND
327329 , arrow_list}
328- ,{LINEEND}
329330 ,{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
330331 ,{}
331332 ,{}
@@ -341,22 +342,23 @@ namespace jstr
341342 | INDENT
342343 statement_list
343344 | statement
345+ statement_list
344346 | declaration
347+ statement_list
345348 | LINEEND
346- | DEDENT
347349 | <ε>*/
348350 {INDENT
349351 , statement_list}
350- ,{statement}
351- ,{declaration}
352+ ,{statement, statement_list}
353+ ,{declaration, statement_list}
352354 ,{LINEEND}
353- ,{DEDENT}
354355 ,{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
355356 ,{}
356357 ,{}
357358 ,{}
358359 ,{}
359360 ,{}
361+ ,{}
360362 }
361363 , {
362364 /*statement : case_statement
@@ -453,10 +455,12 @@ namespace jstr
453455 /*case_statement : CASE
454456 expression
455457 COLON
458+ INDENT
456459 case_type_list*/
457460 {CASE
458461 , expression
459462 , COLON
463+ , INDENT
460464 , case_type_list}
461465 ,{}
462466 ,{}
@@ -470,19 +474,19 @@ namespace jstr
470474 ,{}
471475 }
472476 , {
473- /*case_type_list :
474- INDENT
477+ /*case_type_list:
475478 TYPE
476479 IDENTIFIER
477480 COLON
478481 statement_list
482+ DEDENT
479483 case_type_list
480484 | <ε>*/
481- {INDENT
482- , TYPE
485+ {TYPE
483486 , IDENTIFIER
484487 , COLON
485488 , statement_list
489+ , DEDENT
486490 , case_type_list}
487491 ,{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
488492 ,{}
@@ -539,15 +543,20 @@ namespace jstr
539543 }
540544 , {
541545 /*bee_else_part :
542- INDENT
543546 ELSE
544547 statement_list
545- | INDENT
546- ELSE
547- if_statement
548+ | ELSEIF
549+ expression
550+ COLON
551+ statement_list
552+ bee_else_part
548553 | <ε>*/
549- {INDENT, ELSE, statement_list}
550- ,{INDENT, ELSE, if_statement}
554+ {ELSE, statement_list}
555+ ,{ELSEIF
556+ , expression
557+ , COLON
558+ , statement_list
559+ , bee_else_part}
551560 ,{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
552561 ,{}
553562 ,{}
--- a/test/classtest.j
+++ b/test/classtest.j
@@ -130,7 +130,7 @@ Hg < hogehoge < hoge:
130130 ;
131131
132132 Hf:
133- i32 i = 0;
133+ i32 i = 0
134134 ...
135135 ffg:
136136 i++;
--- a/test/datatypetest.j
+++ b/test/datatypetest.j
@@ -60,6 +60,7 @@ hoge:
6060 };
6161 lam f = x -> {x+1};
6262 lam g = x -> {y -> {x+y}};
63+ xml fx = <x></x>
6364 ...
6465 ff:
6566 ;
@@ -104,6 +105,7 @@ hogehoge:
104105 }
105106 };
106107 lam f = x ->{x+i};
108+ xml fx = <x></x>
107109 ;
108110 ;
109111
--- a/test/excepttest.j
+++ b/test/excepttest.j
@@ -17,7 +17,7 @@ main:
1717
1818 hoge:
1919 i08 a = 0;
20- detach coroutine;
20+ detach;
2121 obj o = new hoge();
2222 ...
2323 f: