j-brant / smacc Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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 ) ?
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' {{}}
;
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!
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?
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 π
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.
I forgot if there ever was one, but is SmaCC not supposed to be MIT?
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 {
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.