5 let sq_close_ri = HTMLABLEC(FONT_UFH,"]", "]")
7 %token <Render_info.t> LITERAL DELIMITER
8 %token <string> FUN_AR2 FUN_INFIX FUN_AR1 DECL FUN_AR1opt BIG FUN_AR2nb
9 %token <string*string> BOX
10 %token <string*(string*string)> FUN_AR1hl
11 %token <string*Render_info.font_force> FUN_AR1hf DECLh
12 %token <string*(Tex.t->Tex.t->string*string*string)> FUN_AR2h
13 %token <string*(Tex.t list->Tex.t list->string*string*string)> FUN_INFIXh
14 %token EOF CURLY_OPEN CURLY_CLOSE SUB SUP SQ_CLOSE NEXT_CELL NEXT_ROW
15 %token BEGIN__MATRIX BEGIN_PMATRIX BEGIN_BMATRIX BEGIN_BBMATRIX BEGIN_VMATRIX BEGIN_VVMATRIX BEGIN_CASES BEGIN_ARRAY BEGIN_ALIGN BEGIN_ALIGNAT BEGIN_SMALLMATRIX
16 %token END__MATRIX END_PMATRIX END_BMATRIX END_BBMATRIX END_VMATRIX END_VVMATRIX END_CASES END_ARRAY END_ALIGN END_ALIGNAT END_SMALLMATRIX
18 %type <Tex.t list> tex_expr
24 | ne_expr FUN_INFIX ne_expr EOF
25 { [TEX_INFIX($2,$1,$3)] }
26 | ne_expr FUN_INFIXh ne_expr EOF
27 { let t,h=$2 in [TEX_INFIXh(t,h,$1,$3)] }
32 lit_aq expr { $1 :: $2 }
33 | litsq_aq expr { $1 :: $2 }
34 | DECLh expr { let t,h = $1 in [TEX_DECLh(t,h,$2)] }
37 | litsq_dq { let base,downi = $1 in TEX_DQ(base,downi) }
38 | litsq_uq { let base,upi = $1 in TEX_UQ(base,upi)}
41 litsq_dq SUP lit { let base,downi = $1 in TEX_FQ(base,downi,$3) }
42 | litsq_uq SUB lit { let base,upi = $1 in TEX_FQ(base,$3,upi) }
44 litsq_zq SUP lit { $1,$3 }
46 litsq_zq SUB lit { $1,$3 }
48 | SQ_CLOSE { TEX_LITERAL sq_close_ri }
51 | lit_aq expr_nosqc { $1 :: $2 }
54 | lit_dq { let base,downi = $1 in TEX_DQ(base,downi) }
55 | lit_uq { let base,upi = $1 in TEX_UQ(base,upi)}
56 | lit_dqn { TEX_DQN($1) }
57 | lit_uqn { TEX_UQN($1) }
61 lit_dq SUP lit { let base,downi = $1 in TEX_FQ(base,downi,$3) }
62 | lit_uq SUB lit { let base,upi = $1 in TEX_FQ(base,$3,upi) }
63 | lit_dqn SUP lit { TEX_FQN($1, $3) }
77 | LEFT SQ_CLOSE { sq_close_ri }
79 RIGHT DELIMITER { $2 }
80 | RIGHT SQ_CLOSE { sq_close_ri }
82 LITERAL { TEX_LITERAL $1 }
83 | DELIMITER { TEX_LITERAL $1 }
84 | BIG DELIMITER { TEX_BIG ($1,$2) }
85 | BIG SQ_CLOSE { TEX_BIG ($1,sq_close_ri) }
86 | left expr right { TEX_LR ($1,$3,$2) }
87 | FUN_AR1 lit { TEX_FUN1($1,$2) }
88 | FUN_AR1hl lit { let t,h=$1 in TEX_FUN1hl(t,h,$2) }
89 | FUN_AR1hf lit { let t,h=$1 in TEX_FUN1hf(t,h,$2) }
90 | FUN_AR1opt expr_nosqc SQ_CLOSE lit { TEX_FUN2sq($1,TEX_CURLY $2,$4) }
91 | FUN_AR2 lit lit { TEX_FUN2($1,$2,$3) }
92 | FUN_AR2nb lit lit { TEX_FUN2nb($1,$2,$3) }
93 | FUN_AR2h lit lit { let t,h=$1 in TEX_FUN2h(t,h,$2,$3) }
94 | BOX { let bt,s = $1 in TEX_BOX (bt,s) }
95 | CURLY_OPEN expr CURLY_CLOSE
97 | CURLY_OPEN ne_expr FUN_INFIX ne_expr CURLY_CLOSE
98 { TEX_INFIX($3,$2,$4) }
99 | CURLY_OPEN ne_expr FUN_INFIXh ne_expr CURLY_CLOSE
100 { let t,h=$3 in TEX_INFIXh(t,h,$2,$4) }
101 | BEGIN__MATRIX matrix END__MATRIX { TEX_MATRIX ("matrix", $2) }
102 | BEGIN_PMATRIX matrix END_PMATRIX { TEX_MATRIX ("pmatrix", $2) }
103 | BEGIN_BMATRIX matrix END_BMATRIX { TEX_MATRIX ("bmatrix", $2) }
104 | BEGIN_BBMATRIX matrix END_BBMATRIX { TEX_MATRIX ("Bmatrix", $2) }
105 | BEGIN_VMATRIX matrix END_VMATRIX { TEX_MATRIX ("vmatrix", $2) }
106 | BEGIN_VVMATRIX matrix END_VVMATRIX { TEX_MATRIX ("Vmatrix", $2) }
107 | BEGIN_ARRAY matrix END_ARRAY { TEX_MATRIX ("array", $2) }
108 | BEGIN_ALIGN matrix END_ALIGN { TEX_MATRIX ("aligned", $2) }
109 | BEGIN_ALIGNAT matrix END_ALIGNAT { TEX_MATRIX ("alignedat", $2) }
110 | BEGIN_SMALLMATRIX matrix END_SMALLMATRIX { TEX_MATRIX ("smallmatrix", $2) }
111 | BEGIN_CASES matrix END_CASES { TEX_MATRIX ("cases", $2) }
114 | line NEXT_ROW matrix { $1::$3 }
117 | expr NEXT_CELL line { $1::$3 }