CndErrorHighlightingDesignSpec

C/C++ Error Highlighting design and implementation details

Proposed levels of error highlighting

  1. Provide errors from parser (syntax errors as such)
  2. Provide unresolved symbol errors

The stack of the current model data flow

  • Lexer: builds token list for a file. No preprocessor.
  • APT: builds a tree that represents file structure from preprocessor point of view
  • Walker (preprocessor): expands macros, processes #includes, gathers token stream
  • Parser: produces AST. Doesn't know model at all.
  • Renderer: renders the AST, builds the model. Sometimes resolves names (e.g. for construct like int N::C::foo()). The functionality is spread over the CsmRenderer and several descendants.

Context provider services

We need this to provide unresolved symbol errors.

Context is an interface with 2 methods:

1) returns what does the given name mean (what model element it refers)

2) returns the collection of all symbols available in the given context

The implementation uses a stack; the element of the stack is the storage for the current scope. Each time we enter the scope, the element is pushed to the stack. Names defined within the current scope are added to this topmost stack element. As soon as we leave the scope, we pop the element from the stack.

Currently, the best place to implement such services is the renderer.

Issues to solve

  • Context provider services.
  • High priority parser queue
  • Ability to process currently edited file differently

Minor issues

  • Parser doesn't provide understandable error messages, they are all "unexpected token"
  • Too many error messages from parser for a single errors
  • Inaccuracy
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo