Changeset 66 in text-formbuilder for trunk/lib/Text/FormBuilder/grammar
- Timestamp:
- 03/11/05 15:17:59 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder/grammar
r64 r66 1 { 1 { 2 #$::RD_TRACE = 1; 2 3 my ( 3 4 $context, # line or group … … 56 57 { $lists{$item{var_name}} = [ @options ]; @options = () } 57 58 58 static_list: '{' option(s /,\s*/) /,?/ '}'59 static_list: '{' /\s*/ option(s /\s*,\s*/) /,?/ /\s*/ '}' 59 60 60 61 dynamic_list: '&' <perl_codeblock> … … 160 161 161 162 # this is the real heart of the thing 162 field: name field_size(?) growable(?) label(?) hint(?) type(?) default(?) option_list(?) validate(?)163 field: name field_size(?) growable(?) label(?) hint(?) type(?) other(?) default(?) option_list(?) validate(?) comment(?) 163 164 { 164 165 my $field = { 165 166 name => $item{name}, 166 growable => ($item{'growable(?)'}[0] ? 1 : 0),167 growable => $item{'growable(?)'}[0], 167 168 label => $item{'label(?)'}[0], 168 169 comment => $item{'hint(?)'}[0], 169 170 type => $item{'type(?)'}[0], 171 other => $item{'other(?)'}[0], 170 172 value => $item{'default(?)'}[0], 171 173 list => $list_var, … … 214 216 { $rows = $item[1]; $cols = $item[3] } 215 217 216 growable: '*' 218 growable: '*' limit(?) { $item{'limit(?)'}[0] || 1 } 219 220 limit: /\d+/ 217 221 218 222 label: '|' (simple_multiword | quoted_string) { $item[2] } … … 224 228 builtin_field: /textarea|text|password|file|checkbox|radio|select|hidden|static/ 225 229 230 other: '+' 'other' { 1 } 226 231 227 232 default: '=' (simple_multiword | quoted_string) { $item[2] } 228 233 229 234 # for simple multiword values not involving punctuation 230 simple_multiword: <skip:''> / [\w\t ]+/ { $item[2] }235 simple_multiword: <skip:''> /\w[\w\t ]+/ { $item[2] } 231 236 232 237 # my attempt at a single-quoted, non-interpolating string … … 237 242 option_list: options | list_var 238 243 239 options: '{' option(s /, \s*/) '}'244 options: '{' option(s /,/) '}' 240 245 241 246 list_var: /@[A-Z_]+/ { $list_var = $item[1] } 242 247 243 option: (simple_multiword | value |quoted_string) display_text(?)248 option: (simple_multiword | quoted_string) display_text(?) 244 249 { push @options, { $item[1] => $item{'display_text(?)'}[0] } } 245 250
Note: See TracChangeset
for help on using the changeset viewer.