Find the answer to your Linux question:
Results 1 to 3 of 3
I need rule that would capture the rest of the line after a token match: Code: %x SLURP identifier [a-zA-Z]+ pluseq \+= qmarkeq \?= equals = restofline [^\n]* {identifier} {return ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    3

    Flex beginner question

    I need rule that would capture the rest of the line after a token match:

    Code:
    %x SLURP
    
    identifier [a-zA-Z]+
    pluseq \+=
    qmarkeq \?=
    equals =
    restofline [^\n]*
    
    {identifier} {return tok_with_string(IDENTIFIER);}
    
    {pluseq} {BEGIN(SLURP);return tok_with_string(PLUSEQ);}
    {qmarkeq} {BEGIN(SLURP);return tok_with_string(QMARKEQ);}
    {equals} {BEGIN(SLURP);return tok_with_string(EQUALS);}
    
    <SLURP>restofline {BEGIN(INITIAL);return tok_with_string(RESTOFLINE);}
    ...
    I don't see entering SLURP state in the debug output.

  2. #2
    Super Moderator MikeTbob's Avatar
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    7,145
    I'm not a programmer but perhaps you could get more help if you offered more details.
    I do not respond to private messages asking for Linux help, Please keep it on the forums only.
    All new users please read this.** Forum FAQS. ** Adopt an unanswered post.

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    3

    More details

    I am trying to parse the input like:

    foo = rest of the line

    foo is captured by identifier, = is captured by equals.
    I want to capture all text after =, if I use restofline, it captures
    everything. I created a conditional state SLURP which I don't see working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...