Code Monkey home page Code Monkey logo

csharpgrammar's People

Contributors

christianwulf 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

csharpgrammar's Issues

Time to bring C# to netbeans?

Hey man,

I'm working on a plugin to implement C# into netbeans: https://github.com/Chris2011/CSharp-for-netbeans

Do you want to help me with this or do you have time? First I read a lot of tutorials to implement a new language into netbeans. I read about ANTLR that I need a grammar file and with this file, the ANTLR api (In netbeans) creates a lot of other files, that I need. Lexer, token files? Don't know. Maybe I don't need it because you already created it. I don't know atm.

First thing that I tried is ANTLRWorks2: http://tunnelvisionlabs.com/products/demo/antlrworks. It's an application created as a netbeans standalone application, to have syntax highlighting for .g files and generator. When I tried to open your file and hit the action "Generate Recognizer..." I got the error: This command is not valid in legacy (ANTLR 3) mode. But I don't know which. Possible that the syntax, which you need, is available in ANTLR 4 first and not in 3? Whatever I created a bug: tunnelvisionlabs/antlrworks2#55

So let me know, if the project sounds great for you to help or not.

Cheers

Chris

Parser fails to recognize comparison expressions

I tried to use your project to build a syntax tree, but your CSharp4.java parser is not configured to do so. I used csParser.java directly and it seems to fail recognizing comparison expressions. It seems to be a problem in the grammar definition, that causes the parser to try to match a generic construction when it finds something like f = i < 1.
The error is: line 7:11 no viable alternative at input '1'

namespace ConsoleApplication1 { 
    public class TestFileTwo { 
        public void foo ( ) { 
            f = i <mismatched token: [@53,108:108='1',<36>,7:11], resync=< 1> ; 
        } 
    } 
}

Exception while running csMain.java

I used AntlrPluginIDE in eclipse to compile .g files.
All done without error.
I then ran csMain and I got the following error :

Exception in thread "main" java.lang.NullPointerException
    at lang.csharp.CSharp4PreProcessor.mTokens(CSharp4PreProcessor.java:2698)
    at lang.csharp.CSharp4PreProcessorImpl.mTokens(CSharp4PreProcessorImpl.java:44)
    at org.antlr.runtime.Lexer.nextToken(Lexer.java:89)
    at org.antlr.runtime.BufferedTokenStream.fetch(BufferedTokenStream.java:133)
    at org.antlr.runtime.BufferedTokenStream.sync(BufferedTokenStream.java:127)
    at org.antlr.runtime.CommonTokenStream.skipOffTokenChannels(CommonTokenStream.java:110)
    at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:99)
    at org.antlr.runtime.BufferedTokenStream.LA(BufferedTokenStream.java:162)
    at lang.csharp.CSharp4.all_member_modifiers(CSharp4.java:16026)
    at lang.csharp.CSharp4.type_declaration(CSharp4.java:14524)
    at lang.csharp.CSharp4.namespace_member_declaration(CSharp4.java:14458)
    at lang.csharp.CSharp4.namespace_member_declarations(CSharp4.java:14384)
    at lang.csharp.CSharp4.compilation_unit(CSharp4.java:13778)
    at grammar.antlr.csMain.parseWithCSharp4(csMain.java:63)
    at grammar.antlr.csMain.main(csMain.java:44)

Then source code line is :

gUnicode.mTokens(); if (state.failed) return ;

in CSharp4PreProcessor.java function :

public void mTokens() throws RecognitionException {
        // C:\\Users\\olivier\\workspace\\CSharpGrammar-master\\grammars\\CSharp4PreProcessor.g:1:8: ( Pp_directive | Unicode. Tokens | CSharp4Lexer. Tokens )
        int alt64=3;
        alt64 = dfa64.predict(input);
        switch (alt64) {
            case 1 :
                // C:\\Users\\olivier\\workspace\\CSharpGrammar-master\\grammars\\CSharp4PreProcessor.g:1:10: Pp_directive
                {
                mPp_directive(); if (state.failed) return ;


                }
                break;
            case 2 :
                // C:\\Users\\olivier\\workspace\\CSharpGrammar-master\\grammars\\CSharp4PreProcessor.g:1:23: Unicode. Tokens
                {
                gUnicode.mTokens(); if (state.failed) return ;


                }
                break;
            case 3 :
                // C:\\Users\\olivier\\workspace\\CSharpGrammar-master\\grammars\\CSharp4PreProcessor.g:1:38: CSharp4Lexer. Tokens
                {
                gCSharp4Lexer.mTokens(); if (state.failed) return ;


                }
                break;

        }

    }

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.