Uploaded image for project: 'SonarSlang'
  1. SonarSlang
  2. SONARSLANG-272

[Apex] Resolve ambiguity between identifiers and keywords using Apex AST

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: apex-iteration-3, 1.4
    • Component/s: None
    • Labels:
      None

      Description

      APEX allows some keywords to also be identifiers. From official docs:

      The following are special types of keywords that aren't reserved words and can be used as identifiers:

      after
      before
      count
      excludes
      first
      includes
      last
      order
      sharing
      with
      

      The problem is that we can not enable them directly as KEYWORD, or it would make the AST Validation fail. On top of that:

      • for the parser Unit Tests we make it fail hard (to make sure that our ASTs are correct).
      • for the ruling ITs, we only log the parsing issues (but we want to have as little issues as possible)

      We can not resolve the ambiguity between identifiers and keywords by using only Apex Lexer, we also need the AST from Apex parser.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alban.auzeill Alban Auzeill
                Reporter:
                andrei.epure Andrei Epure
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: