mjackson / citrus

Parsing Expressions for Ruby

Home Page:http://mjackson.github.io/citrus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about repetition of nested rules

seeflanigan opened this issue · comments

In trying to use the following rule

rule metadata_body
  timestamp server_id end_pos word (space | number | ":")* "\n"
end

to parse the line

"#111215 10:45:17 server id 6001  end_log_pos 363693   Write_rows: table id 3694656 flags: STMT_END_F\n"

the call to #parse hangs indefinitely, making it seem like I've caused an infinite loop somewhere.

Being new to Citrus and rather new to PEGs altogether, I'm sure there's some foolish newbie mistake at play here.

What I'm trying to express is "match any word, space, number, or colon, up to the newline character."

Can someone point me toward A Better Way™?

Would you please post the full grammar (or at least all the relevant bits) to the citrus-users Google Group? The problem may lie somewhere in how you've defined space, number, or word.