Hi John

Up near the top of your grammar, I added this line:

lexeme default = action => [value] latm => 1

latm means Longest Acceptable Token Match. 
See http://savage.net.au/Perl-modules/html/marpa.papers/chapter2.html

More below.

On Wednesday, 19 March 2014 09:46:01 UTC+11, John Alvord wrote:
>
> I have made good progress but have hit another sticking point. A smallest 
> test program is here
>
> https://gist.github.com/jalvo2014/9631309
>

This is the code I patched.
 

>
> The sample fragment I am parsing in the test program is
>
> my $ipdt = "*IF *VALUE i5OS_IOA_Cache_Battery.State *EQ Error";
>
> The G1 rule is here [there is an earlier rule that strips out the *IF]
>
> <basic_condition>     ::= '*VALUE' <attribute> <comparison> 
> <compare_string>  action => do_basic   
>
> Attribute has rules 
>
> <attribute>              ::= id '.' id | id
>
> <alpha>              ~ [A-Za-z%*]
>
> <alphanump>              ~ [A-Za-z0-9_%/]*
>
> <id>                ~ <alpha><alphanump>   
>
> Which should pick out the two parts -sort of table and column name
>
> next is
>
> <comparison>          ::= '*EQ' | '*GE' | '*GT' | '*LE' | '*LT' | '*NE'   
>
> The last section - compare_string
>
> <compare_string> ::=   <literal_word> 
> <literal_word> ~ [\S]+ 
>
> I wanted to get that as a text blob. The problem I get is that the 
> attribute section is being managed by <literal_word> and the <attribute> 
> logic is being ignored, The end of the tracing looks like this
>

You wanted to get 'that', being what exactly?

Basically, get the arrayref output and then post-process it.

Others may suggest a simpler way :).
 

>  
>
Lexer "L0" rejected lexeme L1c12-39: literal_word; 
> value="i5OS_IOA_Cache_Battery
> .State"
> Error in SLIF parse: No lexemes accepted at line 1, column 12
>   Rejected lexeme #0: Lexer "L0"; literal_word; 
> value="i5OS_IOA_Cache_Battery.St
> ate"; length = 28
> * String before error: *IF *VALUE\s
> * The error was at line 1, column 12, and at character 0x0069 'i', ...
> * here: i5OS_IOA_Cache_Battery.State *EQ Error
>
> I figure there has to be some ordering about which rules to apply but have 
> not found them after several hours.
>

 It's not a rule-order type of problem.
 

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to