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


Ignore:
Timestamp:
11/03/04 15:18:24 (20 years ago)
Author:
peter
Message:

catch, warn about, and skip unknown directives (lines beginning with !)
optionally use PerlTidy to clean up generated module code
updated version number and docs
write, write_module, and form automatically call build if necessary

File:
1 edited

Legend:

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

    r14 r16  
    1414    } 
    1515 
    16 list_def: '!list' list_name (static_list | dynamic_list) 
    17     { $lists{$item{list_name}} = [ @options ]; @options = () } 
     16list_def: '!list' var_name (static_list | dynamic_list) 
     17    { $lists{$item{var_name}} = [ @options ]; @options = () } 
    1818 
    1919static_list: '{' option(s /,\s*/) /,?/ '}' 
     
    2929    } 
    3030 
    31 list_name: /[A-Z_]+/ 
    32  
    3331description_def: '!description' <perl_codeblock> 
    3432    { warn "[Text::FormBuilder] Description redefined at input text line $thisline\n" if defined $description; 
     
    3836    } 
    3937 
    40 line: <skip:'[ \t]*'> ( title | author | pattern_def | heading | field | comment | blank ) "\n" 
     38line: <skip:'[ \t]*'> ( title | author | pattern_def | heading | unknown_directive | field | comment | blank ) "\n" 
    4139 
    4240title: '!title' /.*/ 
     
    4745    { $author = $item[2] } 
    4846 
    49 pattern_def: '!pattern' pattern_name pattern 
    50     { $patterns{$item{pattern_name}} = $item{pattern} } 
     47pattern_def: '!pattern' var_name pattern 
     48    { $patterns{$item{var_name}} = $item{pattern} } 
    5149 
    52 pattern_name: /[A-Z_]+/ 
    5350pattern: /.*/ 
    5451 
     
    8885name: identifier 
    8986 
     87var_name: /[A-Z_]+/ 
     88 
    9089field_size: '[' ( row_col | size ) ']' 
    9190 
     
    123122 
    124123identifier: /\w+/ 
     124 
     125# skip unknown directives with a warning 
     126unknown_directive: /\!\S*/ /.*/ 
     127    { warn "[Text::Formbuilder] Skipping unknown directive '$item[1]' at input text line $thisline\n"; } 
Note: See TracChangeset for help on using the changeset viewer.