Coder Social home page Coder Social logo

apex-parser's People

Contributors

aaronhurst-google avatar adangel avatar cwarden avatar dependabot[bot] avatar kjonescertinia avatar nawforce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apex-parser's Issues

Name identifier lexed as "NAME" SOSL token

I'm sure I'm doing this wrong, please educate me as needed.

The Lexing pass appears to incorrectly identify name identifiers as the NAME token type from the SOSL section. Not sure how to isolate those token to limit to certain sections. I have a test that demonstrates this but didn't have an obvious fix. I'm not great with ANTLR syntax.

Let me know if I'm not understand that token type correctly. I haven't tested similar tokens but expect they might have the same problem.

test("Name handling", () => {
  const lexer = new ApexLexer(
    new CaseInsensitiveInputStream("test.cls", "record.name")
  );
  const tokens = new CommonTokenStream(lexer);
  expect(tokens.getNumberOfOnChannelTokens()).toBe(4);
  const tList = tokens.getTokens();
  expect(tList[0].type).toBe(ApexLexer.Identifier);
  expect(tList[2].type).toBe(ApexLexer.Identifier);
});

Throws the error, 164 in this case is NAME

    Expected: 230
    Received: 164

      42 |   expect(tList[0].type).toBe(ApexLexer.Identifier);
      43 |   expect(tList[1].type).toBe(ApexLexer.DOT);
    > 44 |   expect(tList[2].type).toBe(ApexLexer.Identifier);
         |                         ^
      45 | });

ApexLexer.ts:

  public static readonly NAME = 164;
  public static readonly Identifier = 230;

An example of where I'm experiencing this in genuine code, accessing the name of a LoggingLevel enum:

  public Log setLogLevel(LoggingLevel level) {
    this.level = level;
    lw.logLevel = level.name();
    return this;
  }

ParseTreeWalker failing from version 2.9.1

Hi @nawforce

The ParseTreeWalker seems to be failing from version 2.9.1, where dependencies were updated. I think this could potentially be an issue with the new pre-release of antlr4ts 0.5.0-alpha.4 , but wondering if you have any ideas on the cause and how to fix it.

Cannot read property 'enterRule' of undefined

Thanks

Output type definitions

Hi,

Can we please update the tsconfig to output declarations (i.e. declarations = true)? This would be super helpful in ides (vscode for example).

Cheers,

Failing to parse System.runAs() and testMethod modifier

Failing to parse System.runAs() and testMethod modifier.
There are no issues with the test classes in the developer console.

Error 1
SyntaxException { line: 36, column: 24, message: "missing ';' at '{'" }

System.runAs(u) { 
  ...
}

Error 2
SyntaxException {
line: 5,
column: 19,
message: "no viable alternative at input 'testMethod void'"
}

static testMethod void testParse() {
  ...
}

ApexLexer not found

Hello, I try to run the tests, and boot in Java and JS, unfortunately, the code doesn't contain the ApexLexer class.

Can you please help me and update the readme?

Windows build action

We have Linux build actions for Java 8 & 11 but could do with a Windows build as well

Update for internal changes

There a few changes available on the internal adt parser that are not yet reflected here. To avoid drift we need to re-sync against the adt version.

Publish latest Maven artifact version

I'd love to get some of your latest changes into the Maven artifact that's being used by the experimental PMD branch. (Some of them will be required for the tests to pass.) Hopefully there is an opportune time to cut a release in the not-too-distant future. Thanks in advance!

SOSL Find clauses

We discovered that the grammar fails to parse the following PMD test code. It fails on FIND 'Foo'. (This is generated by ApexSharingViolationsNestedClassTest.java.)

public with sharing class Outer {
    public void outerSOQL() {
        [FIND 'Foo' IN ALL FIELDS RETURNING Account(Name)];
    }
    public with sharing class Inner {
        public void innerSOQL() {
            // ...
        }
    }
}

The lexer rule:

FindLiteral
    :   '[' WS? 'find' WS '{' FindCharacters? '}'
    ;

surrounds find clause with curly braces, but Apex is different according to here:

The syntax of the FIND clause in Apex differs from the syntax of the FIND clause in SOAP API and REST API:

In the API, the value of the FIND clause is demarcated with braces. For example: FIND {map*} IN ALL FIELDS RETURNING Account (Id, Name), Contact, Opportunity, Lead

In Apex, the value of the FIND clause is demarcated with single quotes. For example: FIND 'map*' IN ALL FIELDS RETURNING Account (Id, Name), Contact, Opportunity, Lead

I haven't confirmed on the platform.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.