| 1 |
/* |
| 2 |
BISON Parser to recognise name definition records. |
| 3 |
A name definiton record ( or def ) has form |
| 4 |
|
| 5 |
variable(s) :: decription text |
| 6 |
|
| 7 |
It is only recognised when in the comment section of a |
| 8 |
code. All lines of the form above are treat as def |
| 9 |
records. All other comment or executable statements are |
| 10 |
ignored. |
| 11 |
|
| 12 |
The parser is fragile and can have problems with unterminated quotes. |
| 13 |
|
| 14 |
*/ |
| 15 |
|
| 16 |
%union { |
| 17 |
int LineNo; |
| 18 |
char *symbolName; |
| 19 |
} |
| 20 |
|
| 21 |
%token <LineNo> OTHER |
| 22 |
%token <LineNo> NL |
| 23 |
%token <symbolName> VNAME |
| 24 |
%token <symbolName> DEF_STRING |
| 25 |
%token <symbolName> DEF_PUNCT |
| 26 |
%token <symbolName> DEF_COMMA |
| 27 |
%token <LineNo> CALL |
| 28 |
%token <LineNo> NAMELIST |
| 29 |
%token <LineNo> FSLASH |
| 30 |
%token <LineNo> CPP_IFDEF |
| 31 |
%token <LineNo> CPP_IFNDEF |
| 32 |
%token <LineNo> CPP_DEFINE |
| 33 |
%token <LineNo> CPP_UNDEF |
| 34 |
%token <LineNo> CPP_ELIF |
| 35 |
%token <LineNo> CPP_IF |
| 36 |
%type <LineNo> call |
| 37 |
|
| 38 |
|
| 39 |
input: |
| 40 |
| input def |
| 41 |
| input OTHER |
| 42 |
; |
| 43 |
|
| 44 |
def1: def_v_list '::' descript NL |
| 45 |
; |
| 46 |
|
| 47 |
def2: ',' def_v_list '::' descript NL |
| 48 |
; |
| 49 |
|
| 50 |
def3: '::' descript NL |
| 51 |
; |
| 52 |
|
| 53 |
def4: def4 def2 |
| 54 |
| def2 |
| 55 |
; |
| 56 |
|
| 57 |
def5: def5 def3 |
| 58 |
| def3 |
| 59 |
; |
| 60 |
|
| 61 |
def: def1 |
| 62 |
| def1 def4 |
| 63 |
| def1 def5 |
| 64 |
| def1 def4 def5 |
| 65 |
; |
| 66 |
|
| 67 |
descript: descript sentence |
| 68 |
| sentence |
| 69 |
; |
| 70 |
|
| 71 |
def_v_list: VNAME |
| 72 |
| def_v_list ',' VNAME |
| 73 |
|
| 74 |
sentence: sentence phrase |
| 75 |
| phrase |
| 76 |
|
| 77 |
phrase: DEF_STRING |
| 78 |
| DEF_STRING def_punct |
| 79 |
| def_punct |
| 80 |
| def_punct DEF_STRING |
| 81 |
|
| 82 |
def_punct: DEF_COMMA |
| 83 |
| DEF_PUNCT |