mirror of
https://github.com/TheRealOwenRees/pgn_to_tex.git
synced 2026-11-18 04:42:07 +00:00
feat: add public Pgn_to_tex entry point
Move parsing and rendering internals into the private pgn_to_tex_internal library and rename pgn2tex to converter. Expose only Pgn_to_tex with default to_tex arguments, abstract diagram_data, empty_diagrams, and parse_diagrams_json. Update tests, JS bridge, and README to the new names.
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