Grammar-Kit | Grammar files support & parser/PSI generation for IntelliJ IDEA

 by   JetBrains Java Version: 2022.3.2 License: Non-SPDX

kandi X-RAY | Grammar-Kit Summary

kandi X-RAY | Grammar-Kit Summary

Grammar-Kit is a Java library typically used in Editor, Visual Studio Code applications. Grammar-Kit has no vulnerabilities and it has low support. However Grammar-Kit has 187 bugs, it build file is not available and it has a Non-SPDX License. You can download it from GitHub, Maven.

See [Parsing Expression Grammar (PEG)] for basic syntax. Use ::= for ← symbol. You can also use [ .. ] for optional sequences and { | | } for choices as these variants are popular in real-world grammars. Grammar-Kit source code is the main example of Grammar-Kit application. The grammar for BNF parser and PSI generation can be found [here] grammars/Grammar.bnf).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Grammar-Kit has a low active ecosystem.
              It has 633 star(s) with 121 fork(s). There are 45 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 36 open issues and 205 have been closed. On average issues are closed in 169 days. There are 9 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Grammar-Kit is 2022.3.2

            kandi-Quality Quality

              OutlinedDot
              Grammar-Kit has 187 bugs (2 blocker, 0 critical, 158 major, 27 minor) and 3079 code smells.

            kandi-Security Security

              Grammar-Kit has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Grammar-Kit code analysis shows 0 unresolved vulnerabilities.
              There are 3 security hotspots that need review.

            kandi-License License

              Grammar-Kit has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              Grammar-Kit releases are available to install and integrate.
              Deployable package is available in Maven.
              Grammar-Kit has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              Grammar-Kit saves you 16422 person hours of effort in developing the same functionality from scratch.
              It has 32659 lines of code, 2693 functions and 384 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed Grammar-Kit and discovered the below as its top functions. This is intended to give you an instant insight into Grammar-Kit implemented functionality, and help decide if they suit your requirements.
            • Match tokens
            • ResolveESCHAR
            • Getter for STRING
            • Compress a comment
            • Advances to the next regular expression
            • Reports an error
            • Dumps a grammar file
            • Main entry point
            • Gets the languages to inject
            • Collects all options of a file
            • Performs the actual saving
            • Collect all navigation marker information
            • Return a list of keywords for a given position
            • Generates the runnable
            • Resolves the block
            • Calculate the attribute values
            • Display the PSI file
            • An annotate pn element
            • Builds a template and runs it
            • Adds information about a psi element
            • Suggest keywords for a given position
            • Generates lexer text for lexer
            • Reads a file
            • Accept a visitor for a reference
            • Generate the HTML documentation
            • Checks for problems
            Get all kandi verified functions for this library.

            Grammar-Kit Key Features

            No Key Features are available at this moment for Grammar-Kit.

            Grammar-Kit Examples and Code Snippets

            No Code Snippets are available at this moment for Grammar-Kit.

            Community Discussions

            QUESTION

            How to handle end of file in IntelliJ grammar kit
            Asked 2019-Jun-10 at 12:54

            I'm working on IntelliJ support for a DSL using the Grammar-Kit. I have a rule in the bnf file which requires an EOF (end of file) token at the end: rule ::= ( object | (( LCURL EOL* properties EOL* RCURL ) | properties ) ) EOL* EOF

            I assumed I can simpy create a lexer rule in the flex file <> { return EOF;} and that's it.. Unfortunately somewhere deeper in the IntelliJ code the logic which handles lexer's advance() method does not finish unless it gets a null from the lexer causing an infinite loop as the end of file returns a not-null token.

            Is there any elegant (simple) way to handle an End Of File in the Grammar-Kit allowing the 'end of file' to be used in the Parser definition (the bnf)?

            ...

            ANSWER

            Answered 2019-Jun-10 at 12:24

            In the end I've simply put an adapter between the generated lexer and its consumer which replaces functionality of the lexer's advance() method. If the EOF has been reached then the next time it will return null. Something like this:

            Source https://stackoverflow.com/questions/56525697

            QUESTION

            Negative lookaheads in Grammar-Kit
            Asked 2017-Aug-26 at 22:51

            Is there a way to do a negative lookahead in Grammar-kit?

            Example: I have two tokens defined A and B and would like the define the a rule that matches A if it is not followed by B.

            I tried to find it in this grammar, but I am not able to read it.

            ...

            ANSWER

            Answered 2017-Aug-26 at 22:51

            Grammar-Kit is based on PEG (Parsing Expression Grammars).

            • Positive lookahead: &XXX
            • Negative lookahead: !XXX

            Source https://stackoverflow.com/questions/45893463

            QUESTION

            Grammar-Kit: how to handle comment tokens
            Asked 2017-May-19 at 13:05

            From the documentation provided for grammar-kit, I cannot figure out how I am supposed to correctly handle something like comments. My lexer currently returns TokenType.WHITE_SPACE for any comment blocks, but then no unique IElementType is generated for me to do syntax highlighting on.

            If I create an IElementType and tell flex to return that for comments, I can perform syntax highlighting, but then that token is not a part of my language spec in the BNF, and so it is considered invalid.

            What is the correct way to pass comments through as white space, but perform syntax highlighting on them in Intellij/grammar-kit/jflex?

            ...

            ANSWER

            Answered 2017-May-19 at 13:05

            You can use Grammar-Kit implementation as a reference:

            1. Lexer
            2. Grammar
            3. ParserDefinition

            Using TokenType.WHITE_SPACE for comments is a bad idea.

            More details can be found here.

            Source https://stackoverflow.com/questions/44062859

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Grammar-Kit

            You can download it from GitHub, Maven.
            You can use Grammar-Kit like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the Grammar-Kit component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
            Maven
            Gradle
            CLONE
          • HTTPS

            https://github.com/JetBrains/Grammar-Kit.git

          • CLI

            gh repo clone JetBrains/Grammar-Kit

          • sshUrl

            git@github.com:JetBrains/Grammar-Kit.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Java Libraries

            CS-Notes

            by CyC2018

            JavaGuide

            by Snailclimb

            LeetCodeAnimation

            by MisterBooo

            spring-boot

            by spring-projects

            Try Top Libraries by JetBrains

            kotlin

            by JetBrainsKotlin

            compose-multiplatform

            by JetBrainsKotlin

            compose-jb

            by JetBrainsKotlin

            JetBrainsMono

            by JetBrainsShell

            ideavim

            by JetBrainsKotlin