A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/088638.html below:

[Python-Dev] Needing help to change the grammar

[Python-Dev] Needing help to change the grammar"Martin v. Löwis" martin at v.loewis.de
Sat Apr 11 07:45:49 CEST 2009
> It appears to be a simple change, but strangely, I'm not being able to
> perform it. I already made correct modifications in Grammar/Grammar
> file, the new keywords already appear in Lib/keyword.py and I also
> changed the function validate_comp_op in Modules/parsermodule.c:
> 
> static int
> validate_comp_op(node *tree)
> {
> (...)
>     else if ((res = validate_numnodes(tree, 2, "comp_op")) != 0) {
>         res = (validate_ntype(CHILD(tree, 0), NAME)
>                && validate_ntype(CHILD(tree, 1), NAME)
>                && (((strcmp(STR(CHILD(tree, 0)), "não") == 0)
>                     && (strcmp(STR(CHILD(tree, 1)), "é") == 0))
>                    || ((strcmp(STR(CHILD(tree, 0)), "não") == 0)
>                        && (strcmp(STR(CHILD(tree, 1)), "em") == 0))));
>         if (!res && !PyErr_Occurred())
>             err_string("operador de comparação desconhecido");
>     }
>     return (res);
> }
> 

Notice that Python source is represented in UTF-8 in the parser.
It might be that the C source code has a different encoding, which
would cause the strcmp to fail.

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4