










Sig: Simplificando el AST
Sup: Análisis Sintáctico con Regexp::Grammars
Ant: Manejo y recuperación de
Err: Si hallas una errata ...
Sometimes, you want to detect problems, but not invalidate the entire
parse as a result. For those occasions, the module provides a less
stringent form of error reporting: the <warning:...> directive.
This directive is exactly the same as an <error:...> in every respect
except that it does not induce a failure to match at the point it
appears.
The directive is, therefore, useful for reporting non-fatal problems
in a parse. For example:
qr{ \A # ...Match only at start of input
<ArithExpr> # ...Match a valid arithmetic expression
(?:
# Should be at end of input...
\s* \Z
|
# If not, report the fact but don't fail...
<warning: Expected end-of-input>
<warning: (?{ "Extra junk at index $INDEX: $CONTEXT" })>
)
# Rule definitions here...
}xms;
Note that, because they do not induce failure, two or more
<warning:...> directives can be "stacked" in sequence, as in the
previous example.











Sig: Simplificando el AST
Sup: Análisis Sintáctico con Regexp::Grammars
Ant: Manejo y recuperación de
Err: Si hallas una errata ...
Casiano Rodríguez León
2012-05-22