[antlr-interest] Dead End

Anakreon Mejdi amejdi at ertonline.gr
Wed Oct 30 06:30:05 PST 2002


I am facing a difficulty with a parser I am writing and need some help.
The program should parse ASP which has html tags and code written in 
JavaScript or VBScript.
I have written an Html Lexer ,an JavaScript Lexer and a Vbs Lexer.
The three Lexers a multiplexed via a TokenStreamSelector called 
AspStreamSelector.
The selector will add few Tokens and consume others in order to make
parsing simpler.

The Dead end is this:
An asp page I attempt to parse includes an other file which has
code written in JavaScript.
The JavaScript Parser fails to parse the file but when the same code is
fed to the Parser when the JavaScript Parser is working alone(not with 
the Vb Parser) it parses the code.

   I checked if the JavaScript parser receives the same tokens when is 
working alone and when is cooperating with the Vb Parser.
The only difference was that the tokens (when in asp) had a line number 
grater by one.

However the type and text of the Tokens are the same and delivered
to the Parser in the same sequence.

For two days now I couldn't find a solution to this problem
and can not understand what causes it.

I hope someone can help.

The mail has as attachment the files of the project.

Among the files there is build.xml which will compile the project
if you have ant.

In the src directory there are Main.java,Main2.java,Main3.java
Main.java will parse a plain Vb Script
Example java Main <aVbsFile > out.txt will print in file out.txt the AST
java Main anything<aVbsFile > out.txt will print in file out.tx the 
token stream.
Main3 works in the same way only that takes as input JavaScript Code.

Main2 parser an ASP page (Vbs,JS,Html mixed)
java Main2 pathToAnASP directoryWhereTheFileIs > out.txt will print the 
AST
java Main2 pathToAnASP directoryWhereTheFileIs anything> out.txt will 
print the Stream of Token

In the tests directory I have an asp file which can be used as an example.


Thanks for any help.
Anakreon





 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: asp_parser.tgz
Type: application/x-compressed
Size: 46093 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20021030/3647ae14/asp_parser.bin


More information about the antlr-interest mailing list