Changeset 80 in text-formbuilder for trunk/lib/Text/FormBuilder/grammar


Ignore:
Timestamp:
04/12/05 11:23:36 (19 years ago)
Author:
peichman
Message:

added a !submit directive to rename the submit button or to have multiple submit buttons
upped version number

File:
1 edited

Legend:

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

    r77 r80  
    2424        $rows, 
    2525        $cols, 
     26        @submit, 
    2627    ); 
    2728    my $context = 'line';       # start in line context by default 
     
    3839        %formspec = ();  # clear the old formspec data 
    3940    } 
    40     (list_def | description_def | group_def | note | line)(s) 
     41    (list_def | description_def | group_def | note | unknown_block_directive | line)(s) 
    4142    { 
    4243        # grab the last section, if there is any 
     
    5960            groups   => \%groups, 
    6061            sections => \@sections, 
     62            ( @submit ?  
     63                (submit => @submit == 1 ? $submit[0] : \@submit) : 
     64                () 
     65            ), 
    6166        } 
    6267    } 
     
    106111field_line: <skip:'[ \t]*'> ( field | comment | blank ) "\n" 
    107112 
    108 line: <skip:'[ \t]*'> ( title | author | pattern_def | section_head | heading | group_field | field_group | unknown_directive | field | comment | blank ) "\n" 
     113line: <skip:'[ \t]*'> ( title | author | pattern_def | section_head | heading | submit | group_field | field_group | unknown_directive | field | comment | blank ) /\n+/ 
    109114 
    110115title: '!title' /.*/ 
     
    145150 
    146151heading: '!head' /.*/    { push @lines, [ 'head', $item[2] ] } 
     152 
     153submit: '!submit' string(s /\s*,\s*/) 
     154    { 
     155        #warn scalar(@{ $item[2] }) . ' submit button(s)'; 
     156        push @submit, @{ $item[2] }; 
     157    } 
    147158 
    148159group_field: '!field' group_name name label(?) 
     
    243254 
    244255# for simple multiword values not involving punctuation 
    245 simple_multiword: <skip:''> /\w[\w\t ]*/ { $item[2] } 
     256simple_multiword: /\w/ <skip:''> /[\w\t ]*/ { $item[1] . $item[3] } 
    246257 
    247258# my attempt at a single-quoted, non-interpolating string 
    248259# where the backslash can escape literal single quotes 
    249 quoted_string: <skip:''> "'" /(\\'|[^'])*/ "'" 
     260quoted_string: "'" <skip:''> /(\\'|[^'])*/ "'" 
    250261    { $item[3] =~ s/\\'/'/g; $item[3] } 
    251262 
     
    278289unknown_directive: /\!\S*/ /.*/ 
    279290    { warn "[Text::Formbuilder] Skipping unknown directive '$item[1]' at input text line $thisline\n"; } 
     291 
     292unknown_block_directive: /\!\S*/ var_name(?) block 
     293    { warn "[Text::Formbuilder] Skipping unknown block directive '$item[1]' at input text line $thisline\n"; } 
Note: See TracChangeset for help on using the changeset viewer.