0 Replies Latest reply on Jun 29, 2009 8:50 AM by Steven Alexson

    Grammar file for .NET GLOBAL.ASAX

      I am trying to write a grammar file to parse a .NET GLOBAL.ASAX config file. The format is as follows:

       

      PARAMETER = VALUE 'COMMENT

       

      I want Name to be PARAMETER, Value 1 to be VALUE, and Value 2 to be 'COMMENT

       

      The value may be quoted or unquoted, it may or may not contain spaces, and it may be seperated from comments by one or more whitespaces.

       

      I have my grammar file parsing 99% of the file, but I am having problems getting lines that have multiple comments (denoted by 'Comment1 'Comment2) parsed. The comment remains part of Value 1 instead of being displayed as Value 2.

       

      Paul Cannon and I were able to get this grammar file working once, but somehow (mysteriously) the file was lost. I am now trying to recreate this file, but neither Paul nor I remember what we did to get it working.

       

      Here is what my grammar file looks like so far:

       

       

      REMOVE_TRAILING_SPACES 1

       

      TEMP temp

       

      VAR_EQUAL =

      VAR_WS \t

       

      %%

       

      WS /t/n%20*

      KEY [\t\n=']+

      VAL [\t\n']+

      EQUAL =

      COMMENT '.*

      LCOMMENT <.*

       

      %%

       

      comment COMMENT $save_as_comment $0

      lcomment LCOMMENT $save_as_comment $0

       

      record0 KEY WS EQUAL WS VAL WS COMMENT $set_parent $TEMP \

      $new_field $0 $new_field $4 $new_field $6 $save_record $0 $set_add_rule $0

       

      record1 KEY WS EQUAL WS VAL $set_parent $TEMP \

      $new_field $0 $new_field $4 $save_record $0 $set_add_rule $1

       

      %%

       

      add_record0 $write_field $0 $write_var $VAR_EQUAL $write_field $1 VAR_WS $write_field $2

      add_record1 $write_field $0 $write_var $VAR_EQUAL $write_field $1

       

      Message was edited by:

      Steven Alexson

       

      Message was edited by:

      Steven Alexson

       

      Message was edited by:

      Steven Alexson