[prev in list] [next in list] [prev in thread] [next in thread] 

List:       antlr-interest
Subject:    [antlr-interest] html parser,
From:       Matěj_Plch <plchmate () fit ! cvut ! cz>
Date:       2011-12-20 11:28:55
Message-ID: 4EF07177.1060708 () fit ! cvut ! cz
[Download RAW message or body]

Hi, Im trying to write simple HTML parser (with antlr4ruby) and Im 
facing two problems:

1. If I have HTML element attributes I need to write rule to match any 
combination of them, but every can be only once there, like:
<body bgcolor="" background=""> <body background="" bgcolor="">

2. I match attributes values in this way:
attr_svalue: ASSIGN SVALUE;
align_value: ASSIGN AVALUE;

SVALUE: { @tagMode }?=>
         ( '"' (~'"')* '"'
         | '\'' (~'\'')* '\''
         )
     ;

AVALUE
          : { @tagMode }?=> '"' ('left'|'right'|'center') '"'
          ;

But SVALUE rule hides AVALUE. How can be this done to match both?

Thanks in advance.

Matej Plch


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic