Giter Site home page Giter Site logo

vscode-ebnf's People

Contributors

igochkov avatar

Stargazers

 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

vscode-ebnf's Issues

"Toggle Line Comment" command creates C-style comment

Installed product versions

  • Visual Studio Code: 1.85.1
  • This extension: 1.3.1

Description

Toggling line comments (e.g. by pressing ctrl+/) adds a C-style comment

Steps to recreate

  1. Open an EBNF file
  2. Press ctrl+/ (or cmd+/ on macOS)
Screenshot 2024-01-18 at 10 24 15 AM

Current behavior

Adds C-style line comment // ... to the beginning of the line

Expected behavior

Ideally it should add (* ... *) style comment to the line

Parsing fails for `comment = ’(*’, {comment symbol}, ’*)’;`

COMMENT is defined in the lexer. As a result, the parser has difficulties parsing it's own grammar, in particularly this line:
comment = ’(*’, {comment symbol}, ’*)’;

Everything between (* and *) is considered a comment by the lexer. Because the lexer has already matched the comment the parser sees only the rest, which is:
comment = ’’;

The solution is to define the comment rule in the parser, and not in the lexer, however it will 'pollute' the grammar with the comment rule everywhere. According the official EBNF grammar, a comment is allowed anywhere outside a <terminal string>, <meta identifier>, <integer> or <special sequence>.

comment = ’(*’, {comment symbol}, ’*)’;
comment symbol = comment | terminal string | special sequence | character;

Closing comment symbol

If you press Enter just before the closing comment symbol, the closing comment symbol is removed.
Obviously it should not do that.

Problem with coloring

Installed product versions

  • Visual Studio Code: 1.89.0
  • This extension: 1.3.1

Description

The coloring is affected by a special '¬' character. Deleting the optional part with that character solves the problem and the coloring works fine again.
imagen

Steps to recreate

  1. Copy this snippet into an ebnf file:
special-symbol = '+' | '-' | '*' | '/' | '¬' | '=' | '<' | '>' | '[' | ']' | '.' | ',' | ':' |
                 ';' | '^' | '(' | ')' | '<>' | '<=' | '>=' | ':=' | '..' | 
                 'and' | 'array' | 'begin' | 'case' | 'const' | 'div' | 'do' | 'downto' | 'else' |
              'end' | 'file' | 'for' | 'function' | 'goto' | 'if' | 'in' | 'label' | 'mod' |
              'nil' | 'not' | 'of' | 'or' | 'packed' | 'procedure' | 'program' | 'record' |
              'repeat' | 'set' | 'then' | 'to' | 'type' | 'until' | 'var' | 'while' | 'with' ;

Current behavior

The coloring is incorrect when using the character '¬' in an ebnf option specification.

Expected behavior

The coloring should be correct for a rule containing that character.

Formatting selection issue

If a part of a multi-line syntax rule is selected, the formatting should expand to the hole syntax rule instead of formatting only the selection.

For example format of this selection:
image

results in:
image

but should be:
image

Consider disabling the "format selection" option until fixed.

Reduce package size

Remove all images from the package but the icon. Reference them from other location.

Code formatter breaks with partially invalid syntax

Installed product versions

  • Visual Studio Code: 1.85.1
  • This extension: 1.3.1

Description

Formatting code with partially invalid syntax causes code to be lost.

Steps to recreate

  1. Create a file with syntax in a manner similar to the below screenshots
  2. Format the code
  3. Code after broken syntax is lost

Before code formatting:

Screenshot 2024-01-18 at 10 07 29 AM

Afte code formatting:

Screenshot 2024-01-18 at 10 07 34 AM

Current behavior

All the code before the broken syntax is formatted properly, but everything after is deleted

Expected behavior

Formatting a file with invalid syntax should not do anything to the file.

Formatting Issues

Installed product versions

  • Visual Studio Code: 1.83.1
  • This extension: 1.3.0

Description

Formatting does really weird stuff with escaping and the | symbol if the newline option is turned off

Steps to recreate

Weird | Formatting

  • Write letter = "A" | "B" | "C" | "D" | "E" | "F";
  • Press Alt+Shift+F
  • It now for some reason removed all the spaces before the |
    • So now it would be letter = "A"| "B"| "C"| "D"| "E"| "F";

Not being able to write "\"

  • Write a term like "\\", "\\\\\\", '\\', "\", '\', '\\\\', it literally doesn't matter how many backslashes
  • Press Alt+Shift+F
  • Now it just completely deleted all the \ inside the terms

Current behavior

Explained above

Expected behavior

Not do that

syntax coloring is unexpected

I like the functionality of this extension a lot. However, it chooses syntax colors that aren't what I would expect.

  • I would expect strings in an EBNF specification to appear in the same color as constant strings in code, e.g. in a Python program. In my Visual Studio theme (Light Modern), this is red. But with this extension strings appear black.

  • This extension colors a non-terminal that's being defined (on the left side of '=') in the same color that Visual Studio uses for keywords in programming languages. In the Light Modern theme this is blue. That seems wrong to me, since a non-terminal is not a keyword. In my opinion, a non-terminal that's being defined should have the same color as a non-terminal that's being used (on the right side of '='). By analogy, if I write Python code such as

def foo(x):
   return bar(x)

then VS Code displays 'foo' and 'bar' in the same color, even though 'foo' is a function that's being defined and 'bar' is a function that's being called. Simply put, they are both the same kind of thing, i.e. a function, so I think they should have the same color.

I know that these colors are a matter of opinion, so if you disagree you can simply close this. But I thought I would at least bring this up.

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.