2009/12/10 Sam Harwell <[email protected]>: > You're making this too complicated. Parse the identifier as loosely as > absolutely possible. Many improper identifiers actually don't cause any > problems in parsing, so you can treat them as valid and provide compiler > error messages like semantics problems in post-AST analysis - the identifiers > are just string literal keys to reference code constructs. After you perform > semantic analysis check each identifier (variable and method names, etc.) by > calling the Character class methods. Log the errors, but you don't have to > stop the analysis from just that.
Right, but isn't it that ANTLR tries to, kind of, 'sync' the parser on an error? So that it does not stop actually the analysis but catches up? > > The general rule is don't engineer your parser to fail until you can no > longer provide useful error messages. You can always manually stop early - > for example sometimes I throw an OperationCancelledException in an error > listener to stop a background parse for IDE IntelliSense after a > user-specified number of errors are logged. > Good idea, but isn't that what ANTLR automatically does? I mean - it does not fail when it doesn't absolutely have to? -- Greetings Marcin Rzeźnicki List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
