[webkit-dev] Problems with JavaScript bison parser
Javed Rabbani
jrabbani at gmail.com
Fri Feb 20 10:25:16 PST 2009
I have just resolved the issue. The problem was found within the Lexer
(JavaScriptCore\parser\Lexer.cpp), and not in Grammar.cpp. The reason that
parser function kjsyypasre() was failing turned out to be related to
improper functioning of isWhiteSpace() function that was not interpreting
the whitespace properly due to incorrect implementation for it in my custom
unicode code. As a result, no subsequent tokens were read after the first
one. The problem has been resolved at my end and there is nothing wrong with
the WebKit code itself. Thanks.
- J R Shah
On Thu, Feb 19, 2009 at 8:58 PM, Javed Rabbani <jrabbani at gmail.com> wrote:
> I am using WebKit revision: 38688 with bison version 2.3. The bison
> generated "DerivedSources\Grammar.cpp" has function kjsyyparse() that is
> failing with return value of 1. The same HTML code is parsed successfully in
> Safari on Windows with the same WebKit revision. In that case; the function
> kjsyyparse() succeeds with return value 0. I hope this clarifies the
> situation a bit. Thanks.
>
> - J R Shah
>
>
> On Thu, Feb 19, 2009 at 8:54 PM, Javed Rabbani <jrabbani at gmail.com> wrote:
>
>> I am using WebKit revision: 38688 with bison version 2.3. The bison
>> generated "DerivedSources\Grammar.cpp" function kjsyyparse() is failing with
>> return value of 1. The same HTML code is parsed successfully in Safari on
>> Windows with the same WebKit revision. In that case; the function
>> kjsyyparse() succeeds with return value 0. I hope this clarifies the
>> situation a bit. Thanks.
>>
>> J R Shah
>>
>> On Thu, Feb 19, 2009 at 8:44 PM, David Kilzer <ddkilzer at webkit.org>wrote:
>>
>>> Which revision of WebKit are you using (or closest to)?
>>>
>>> Which version of bison (bison --version) are you using to generate the
>>> grammar?
>>>
>>> The incorrectly-parsed HTML works fine in Safari on Mac OS X for me.
>>>
>>> Dave
>>>
>>>
>>> ------------------------------
>>> *From:* Javed Rabbani <jrabbani at gmail.com>
>>> *To:* webkit-dev at lists.webkit.org
>>> *Sent:* Thursday, February 19, 2009 5:41:10 AM
>>> *Subject:* [webkit-dev] Problems with JavaScript bison parser
>>>
>>> Hello everyone,
>>>
>>>
>>>
>>> I am working on a WebKit port for some platform and facing an issue with
>>> working of JavaScript bison parser in "Grammar.cpp". If I execute the
>>> following HTML file, everything is parsed without error:
>>>
>>>
>>>
>>> *<html>*
>>>
>>> *<body>*
>>>
>>> *<img src=" webkit_small.jpg" ALT=" " onclick="document.write('Hello
>>> World');" >*
>>>
>>> *</body>*
>>>
>>> *</html>*
>>>
>>>
>>>
>>> However, as soon I specify the same functionality through a separate
>>> function; I run into trouble as the parser inside Grammar.cpp fails with
>>> return value of 1. Here is the source for the HTML file:
>>>
>>>
>>>
>>> *<html>*
>>>
>>> *<body>*
>>>
>>> *<script language="JavaScript">*
>>>
>>> *function OnClickHandler()*
>>>
>>> *{*
>>>
>>> * document.write('Hello World');*
>>>
>>> *}*
>>>
>>> *</script>*
>>>
>>> *<img src=" webkit_small.jpg" ALT=" " onclick=OnClickHandler()>*
>>>
>>> *</body>*
>>>
>>> *</html>*
>>>
>>> * *
>>>
>>> I have figured out so far that parsing fails as it does not get all the
>>> tokens. It only retrieves the first token and interprets it as "FUNCTION
>>> (269)". Afterwards, the execution terminates and no further tokens are read
>>> by the parser. Ideally it should continue with tokens for OPENBRACE (314),
>>> IDENT(317), STRING(318), CLOSEBRACE(315) etc. I am not sure what is going
>>> wrong to this bison parser? If anyone has faced somewhat similar issues; any
>>> help or suggestion is greatly appreciated Thanks.
>>>
>>>
>>>
>>> Regards,
>>>
>>> J R Shah
>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090220/216d3930/attachment.html>
More information about the webkit-dev
mailing list