File: pfb_parser.mly

package info (click to toggle)
mlpost 0.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,776 kB
  • sloc: ml: 17,440; makefile: 469
file content (49 lines) | stat: -rw-r--r-- 1,850 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**************************************************************************/
/*                                                                        */
/*  Copyright (C) Johannes Kanig, Stephane Lescuyer                       */
/*  Jean-Christophe Filliatre, Romain Bardou and Francois Bobot           */
/*                                                                        */
/*  This software is free software; you can redistribute it and/or        */
/*  modify it under the terms of the GNU Library General Public           */
/*  License version 2.1, with the special exception on linking            */
/*  described in file LICENSE.                                            */
/*                                                                        */
/*  This software is distributed in the hope that it will be useful,      */
/*  but WITHOUT ANY WARRANTY; without even the implied warranty of        */
/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  */
/*                                                                        */
/**************************************************************************/

/* File parser.mly */
%{
  open Fonts_type

  let encoding_table = ref (Array.create 256 "")
%}
%token <string> NAME_CHARSTRING, NAME_ENCODING
%token <int> ID_ENCODING
%token DUMB
%type <(string array) * (string list)> pfb_human_main
%type <string list> enc_main
%start pfb_human_main enc_main
%%
pfb_human_main :
DUMB encoding DUMB charstrings DUMB{ 
  let rencoding_table = !encoding_table in
  encoding_table := Array.create 256 "";
  (rencoding_table,$4)}

encoding :
| {}
| ID_ENCODING NAME_ENCODING encoding {(!encoding_table).($1)<-$2 }

charstrings :
| {[]}
| NAME_CHARSTRING charstrings { $1::$2}

enc_main :
| DUMB enc_aux DUMB {$2}

enc_aux :
| {[]}
| NAME_ENCODING enc_aux {$1::$2}