Changeset 66 in text-formbuilder for trunk/lib/Text/FormBuilder


Ignore:
Timestamp:
03/11/05 15:17:59 (20 years ago)
Author:
peichman
Message:

worked on the rules for parsing lists in the grammar
allow end of field line comments
growable fields can specify a limit; e.g. "person*4" to limit to 4
use '+other' to specify that a field should have an 'Other' option (FB 3.02)
rearranged TODOs in the main documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Text/FormBuilder/grammar

    r64 r66  
    1 {  
     1{ 
     2    #$::RD_TRACE = 1; 
    23    my ( 
    34        $context,      # line or group 
     
    5657    { $lists{$item{var_name}} = [ @options ]; @options = () } 
    5758 
    58 static_list: '{' option(s /,\s*/) /,?/ '}' 
     59static_list: '{' /\s*/ option(s /\s*,\s*/) /,?/ /\s*/ '}' 
    5960 
    6061dynamic_list: '&' <perl_codeblock> 
     
    160161 
    161162# this is the real heart of the thing 
    162 field: name field_size(?) growable(?) label(?) hint(?) type(?) default(?) option_list(?) validate(?) 
     163field: name field_size(?) growable(?) label(?) hint(?) type(?) other(?) default(?) option_list(?) validate(?) comment(?) 
    163164    { 
    164165        my $field = { 
    165166            name     => $item{name}, 
    166             growable => ($item{'growable(?)'}[0] ? 1 : 0), 
     167            growable => $item{'growable(?)'}[0], 
    167168            label    => $item{'label(?)'}[0], 
    168169            comment  => $item{'hint(?)'}[0], 
    169170            type     => $item{'type(?)'}[0], 
     171            other    => $item{'other(?)'}[0], 
    170172            value    => $item{'default(?)'}[0], 
    171173            list     => $list_var, 
     
    214216    { $rows = $item[1]; $cols = $item[3] } 
    215217 
    216 growable: '*' 
     218growable: '*' limit(?) { $item{'limit(?)'}[0] || 1 } 
     219 
     220limit: /\d+/ 
    217221 
    218222label: '|' (simple_multiword | quoted_string) { $item[2] } 
     
    224228builtin_field: /textarea|text|password|file|checkbox|radio|select|hidden|static/ 
    225229 
     230other: '+' 'other' { 1 } 
    226231 
    227232default: '=' (simple_multiword | quoted_string) { $item[2] } 
    228233 
    229234# for simple multiword values not involving punctuation 
    230 simple_multiword: <skip:''> /[\w\t ]+/ { $item[2] } 
     235simple_multiword: <skip:''> /\w[\w\t ]+/ { $item[2] } 
    231236 
    232237# my attempt at a single-quoted, non-interpolating string 
     
    237242option_list: options | list_var 
    238243     
    239 options: '{' option(s /,\s*/) '}' 
     244options: '{' option(s /,/) '}' 
    240245 
    241246list_var: /@[A-Z_]+/ { $list_var = $item[1] } 
    242247 
    243 option: (simple_multiword | value | quoted_string) display_text(?) 
     248option: (simple_multiword | quoted_string) display_text(?) 
    244249    { push @options, { $item[1] => $item{'display_text(?)'}[0] } } 
    245250 
Note: See TracChangeset for help on using the changeset viewer.