GithubHelp home page GithubHelp logo

smacc's Issues

Cannot save new parser in Pharo12

Hello

Since Pharo 12 the class builder has changed.
I tried to create a new SmaCC parser for Mermaid grammar. But cannot save the parser because of a bug when saving. It uses the old class builder method.

I can try to fix the issue. Would you accept a PR to make it available for Pharo12 (I hope with retro compatibility for the older Pharo version ) ?

Abusing scanner states for polymorphic grammar rules

Feature suggestion: writing a grammar rule in terms of tokens that have different definitions depending on the scanner state…

%states default insideBraces insideParens;

insideBraces <any> : [^{}]+ ;
insideBraces <leftDelimiter> : \{ ;
insideBraces <rightDelimiter> : \} ;

insideParens <any> : [^()]+ ;
insideParens <leftDelimiter> : \( ;
insideParens <rightDelimiter> : \) ;

# this rule would only be used when the scanner is in one of the two states above
DelimitedContent
    : <any> 'content' {{}}
    | <leftDelimiter> 'content'
        DelimitedContent 'content' *
        <rightDelimiter> 'content' {{}}
;

Add SmaCC_Source_Editing in a group

Hello,

I'd like to use SmaCC for Java and with the source code. But, SmaCC_Source_Editing package is not present in any group (except "all").

Is it possible to have it alone in a group so I can configure my baseline to use both Java and SmaCC_Source_Editing?

(I can do a PR if you want)

Thanks!

Can't parse default method in Java Interface

Hello, it is impossible to parse default method in Java inteface.

For example, it is possible de parse

interface TestInterface1 
{ 
    // default method 
    default void show() 
    { 
        System.out.println("Default TestInterface1"); 
    } 
} 

But not

interface TestInterface1 
{ 
    // default method 
    public default void show() 
    { 
        System.out.println("Default TestInterface1"); 
    } 
} 

In the second example, I had the 'public' modifier.
It is possible (see: https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html)
in section "Static Methods"

I thought the error is probably there

interface_method_declaration 
    : interface_method_header block 'body' {{MethodDeclaration}}
    ;    
interface_method_header 
    : interface_modifiers_opt type_parameters_opt 'typeParameters' type 'type' method_declarator 'declarator' throws_opt 'throws'
    | interface_modifiers_opt type_parameters_opt 'typeParameters' void 'type' method_declarator 'declarator' throws_opt 'throws'
    ;
interface_modifiers_opt
    : modifiers_opt
    | default_modifier 'modifier'
    ;
default_modifier 
    : "default" 'token' {{Modifier}}

But I need help to solve it

If someone has time?

SmaCC Java: startingState for both interface and class declaration

Hello (sorry it's again me 😬 ),

From the previous issue (#9), I've discovered that we cannot use the same startingState to parse a method in Java if the method is written in an Interface or in a Class

ex doesn't work:

JavaParser
		parse: '
public default void show() 
    { 
        System.out.println("Default TestInterface1"); 
    } 
 ' startingAt: JavaParser startingStateForclass_body_declaration.

I think I understand why the parser cannot do that (the grammar is different in an interface and in a class).

So, what do you think we should do in such a case?
Using parse:startingAt:onError?
And give to onError the block that will execute the parsing with another startingPoint?

If yes, I will propose a pull request to add interface_member_declaration as a startingPoint (or maybe we can specify a startingPoint without adding it at the begin of the "parser generator").
If no, I'm interesting about the solution πŸ˜ƒ

Debugging in Pharo 10/11

I was about to get my hands on migrating the debugger to Pharo 10.
I happily discovered that you already did it!
Still, I wondered about the code to check if everything was working fine, and I learned that the parsing debugger does not work with non-GLR parsers.
As a workaround, I implement two methods at #SmaCCParser
#SmaCCParser>>states
^ stateStack.

#SmaCCParser>>currentState
^ currentToken.

It seems to be enough. If you are interested, I can make a pull request with that. I would like any what you think about these changes.

No license file?

I forgot if there ever was one, but is SmaCC not supposed to be MIT?

TypeScript parser cannot parse `export... class`

The TypeScript parser does not support the export modifier for classes

example:

import {
    Component,
    OnDestroy,
    OnInit
} from '@angular/core';

@Component({
    templateUrl: './myComponent.component.html'
})
export class MyComponent extends OtherClass {

}

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.