mirror of
https://github.com/TheRealOwenRees/pgn_to_tex.git
synced 2026-07-23 03:56:57 +00:00
Transfer code (#1)
* copy project root files * import previously created code and rename where needed * fix license and lint * main is now just a JS wrapper * minified main.cjs rather than copying to a newly named file
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
%{
|
||||
open Ast
|
||||
%}
|
||||
|
||||
%token TAG_OPEN TAG_CLOSE LPAREN RPAREN EOF
|
||||
%token <string> HEADER STRING MOVE NUMBER COMMENT RESULT CLOCK NAG
|
||||
|
||||
%start <Ast.game> main
|
||||
|
||||
%%
|
||||
|
||||
main:
|
||||
| ts = tags; c = content; r = option(RESULT); EOF
|
||||
{ { tags = ts; content = c; result = r } }
|
||||
|
||||
tags:
|
||||
| TAG_OPEN; k = HEADER; v = STRING; TAG_CLOSE; rest = tags
|
||||
{ { key = k; value = v } :: rest }
|
||||
| (* empty *)
|
||||
{ [] }
|
||||
|
||||
content:
|
||||
| i = item; rest = content
|
||||
{ i :: rest }
|
||||
| (* empty *)
|
||||
{ [] }
|
||||
|
||||
item:
|
||||
| m = MOVE { Move m }
|
||||
| n = NUMBER { Number n }
|
||||
| c = CLOCK { Clock c }
|
||||
| g = NAG { Nag g }
|
||||
| c = COMMENT { Comment c }
|
||||
| r = RESULT { Result r }
|
||||
| LPAREN; v = content; RPAREN { Variation v }
|
||||
Reference in New Issue
Block a user