Changeset 28 in text-formbuilder for trunk/lib/Text/FormBuilder
- Timestamp:
- 11/17/04 09:07:38 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder/grammar
r25 r28 8 8 %lists, 9 9 %patterns, 10 @fields,11 10 @group, # current group 12 11 %groups, # stored groups of fields 13 @headings,14 12 $type, 15 13 @options, … … 23 21 } 24 22 25 form_spec: (list_def | description_def | group_def | line)(s) 23 form_spec: (list_def | description_def | group_def | line)(s) 26 24 { 27 25 $return = { … … 29 27 author => $author, 30 28 description => $description, 31 lists => \%lists || {}, 32 patterns => \%patterns || {}, 33 headings => \@headings || [], 34 fields => \@fields || [], 35 lines => \@lines || [], 36 groups => \%groups || {}, 29 lists => \%lists, 30 patterns => \%patterns, 31 lines => \@lines, 32 groups => \%groups, 37 33 } 38 34 } … … 71 67 72 68 title: '!title' /.*/ 73 { warn "[Text::Formbuilder] Title redefined at input text line $thisline\n" if defined $title; 74 $title = $item[2] } 69 { 70 warn "[Text::Formbuilder] Title redefined at input text line $thisline\n" if defined $title; 71 $title = $item[2]; 72 } 75 73 76 74 author: '!author' /.*/ 77 { $author = $item[2] } 75 { 76 warn "[Text::Formbuilder] Author redefined at input text line $thisline\n" if defined $author; 77 $author = $item[2]; 78 } 78 79 79 80 pattern_def: '!pattern' var_name pattern … … 82 83 pattern: /.*/ 83 84 84 heading: '!head' /.*/ 85 { 86 warn "[Text::FormBuilder] Header before field " . scalar(@fields) . " redefined at input text line $thisline\n" if defined $headings[@fields]; 87 $headings[@fields] = $item[2]; 88 push @lines, [ 'head', $item[2] ]; 89 } 85 heading: '!head' /.*/ { push @lines, [ 'head', $item[2] ] } 90 86 91 87 group_field: '!field' group_name name label(?) 92 { #warn "[$thisline] $item{group_name}\n";93 88 { 89 push @lines, [ 'group', { name => $item{name}, label => $item{'label(?)'}[0], group => $item{group_name} } ]; 94 90 } 95 91 … … 115 111 $$field{size} = $size if defined $size; 116 112 117 #warn "[$thisline] field $item{name}; context $context\n"; 113 #warn "[$thisline] field $item{name}; context $context\n"; 118 114 if ($context eq 'group') { 119 115 push @group, $field; 120 116 } else { 121 push @fields, $field;122 117 push @lines, [ 'field', $field ]; 123 118 } 124 125 #warn "field $item{name} is required" if $required;126 119 127 120 $type = undef;
Note: See TracChangeset
for help on using the changeset viewer.