Changeset 29 in text-formbuilder for trunk/lib/Text/FormBuilder/grammar
- Timestamp:
- 11/17/04 10:03:41 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder/grammar
r28 r29 2 2 my ( 3 3 $context, # line or group 4 @lines, # master data structure 4 @sections, # master data structure 5 $section_head, 6 $section_id, 7 @lines, # lines in each section 5 8 $title, 6 9 $author, … … 23 26 form_spec: (list_def | description_def | group_def | line)(s) 24 27 { 28 # grab the last section, if there is any 29 if (@lines) { 30 push @sections, 31 { 32 id => $section_id, 33 head => $section_head, 34 lines => [ @lines ], 35 }; 36 } 37 38 $section_id = $item{identifier}; 39 $section_head = $item[3]; 40 @lines = (); 25 41 $return = { 26 42 title => $title, … … 29 45 lists => \%lists, 30 46 patterns => \%patterns, 31 lines => \@lines,32 47 groups => \%groups, 48 sections => \@sections, 33 49 } 34 50 } … … 64 80 65 81 field_line: <skip:'[ \t]*'> ( field | comment | blank ) "\n" 66 line: <skip:'[ \t]*'> ( title | author | pattern_def | heading | group_field | unknown_directive | field | comment | blank ) "\n"82 line: <skip:'[ \t]*'> ( title | author | pattern_def | section_head | heading | group_field | unknown_directive | field | comment | blank ) "\n" 67 83 68 84 title: '!title' /.*/ … … 82 98 83 99 pattern: /.*/ 100 101 section_head: '!section' identifier /.*/ 102 { 103 #warn "starting section $item{identifier}\n"; 104 #warn " with heading $item[3]\n" if $item[3]; 105 106 if (@lines) { 107 push @sections, 108 { 109 id => $section_id, 110 head => $section_head, 111 lines => [ @lines ], 112 }; 113 } 114 115 $section_id = $item{identifier}; 116 $section_head = $item[3]; 117 @lines = (); 118 } 84 119 85 120 heading: '!head' /.*/ { push @lines, [ 'head', $item[2] ] }
Note: See TracChangeset
for help on using the changeset viewer.