JaySon-Huang / asdox

Automatically exported from code.google.com/p/asdox
0 stars 0 forks source link

Problem parsing some files #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I am trying to parse the attached files (they are part of a bigger project : 
http://away3d.com/ ).
Although they seem correct, asDox is raising exceptions and thus not parsing 
them.

For example, parsing file arcane.as
i receive:

Traceback (most recent call last):
  File "asparser.py", line 21, in <module>
    builder.addSource(srcFolder)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/asdox/asBuilder.py", line 43, in addSource
    self.parseSource( open(source,"r").read() )
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/asdox/asBuilder.py", line 57, in parseSource
    asGrammar.PROGRAM.parseString(src.decode("ascii","ignore"))
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/pyparsing.py", line 1076, in parseString
    raise exc
pyparsing.ParseException: Expected "class" (at char 33), (line:3, col:12)

I am using the svn version of asDox (revision 195), in MacOSX Leopard. I had 
the same issues 
using it on Debian Lenny, GNU/Linux

Thank you,
Alberto

Original issue reported on code.google.com by sba...@gmail.com on 20 Jul 2009 at 10:05

Attachments:

GoogleCodeExporter commented 8 years ago
The current version of asDox requires a class declaration. If you are fimilar 
with
PyParsing you could probably tweek the grammar file to make class declaration
optional. I will work with the grammar file to see if its possible.

Original comment by gurufact...@gmail.com on 20 Jul 2009 at 1:46

GoogleCodeExporter commented 8 years ago
I already tried to fix that issue with these lines (in asGrammar.py):

NAMESPACE_DEFINITION = (CLASS_MODIFIERS + NAMESPACE + 
QUALIFIED_IDENTIFIER("name") + 
TERMINATOR)
PACKAGE_BLOCK = LCURL + ZeroOrMore( IMPORT_DEFINITION ^ BASE_BLOCK ^ 
NAMESPACE_DEFINITION ) + 
(CLASS_DEFINITION ^ INTERFACE_DEFINITION) + RCURL

However, I still have problems with the remaining files. For example, I cannot 
find the error in 
LinearExtrude.as, and I cannot change the grammar in order to make asDox 
accepting also function without 
modifiers. I tried putting "optional", like this:

METHOD_DEFINITION = (Optional(METHOD_MODIFIER) + METHOD_SIGNATURE  + 
BLOCK).setParseAction(parseASMethod)

but it doesn't work. It works only if I completely remove the METHOD_MODIFIER, 
but in that case, when there 
is an explicit modifier I get an error..

Thank you for your help,
Alberto

Original comment by sba...@gmail.com on 20 Jul 2009 at 1:55