March 28, 2012 Re: Pegged: Syntax Highlighting | ||||
---|---|---|---|---|
| ||||
On 3/28/12, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote: > On 3/28/12, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote: >> snip > > Ouch, DMD crashes with that autogenerated ddump D grammar file. > Also asModule seems to have stopped generating valid modules since the last time I've tried it. I keep getting this error when importing a generated file: arithmetic.d(44): Error: undefined identifier module arithmetic.empty arithmetic.d(31): called from here: parse(Input(input,Pos(0u,0u,0u),AssociativeList(null))) simpleTest.d(30): called from here: parse("2/(8*7988+1*6196-y)") Failed: "dmd" "-w" "-wi" "-v" "-o-" "simpleTest.d" "-I." |
March 28, 2012 Re: Pegged: Syntax Highlighting | ||||
---|---|---|---|---|
| ||||
On Wed, Mar 28, 2012 at 18:06, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> Okay I got it, you've recently changed some code. I can see it mentioned in the readme:
>
> By default, the grammars do not silently consume spaces, as this is the standard behavior for PEGs. There is an opt-out though, with the simple `<` arrow instead of `<-` (you can see it in the previous example)
>
> So yeah, if I change to '<' it works. :)
Damn, I changed README.md a few days ago and forgot the equivalent page in the wiki :( I knew that duplicating content would cause trouble.
|
March 28, 2012 Re: Pegged: Syntax Highlighting | ||||
---|---|---|---|---|
| ||||
On Wed, Mar 28, 2012 at 19:08, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> On 3/28/12, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
>> snip
>
> Ouch, DMD crashes with that autogenerated ddump D grammar file.
Yeah, I spent two evenings trying to get why there is a segmentation fault. I found some nice bugs (the rules have an internal member called 'name' and for recursive rules it can become infinite). I still don't get why the D grammar does this.
I'll start again, with a C grammar (I read one from the ANSI report today). I should have done it in smaller steps. Right now, I'm more into changing bits of the underlying code and then will code grammars again.
|
March 28, 2012 Re: Pegged: Syntax Highlighting | ||||
---|---|---|---|---|
| ||||
On Wed, Mar 28, 2012 at 19:19, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> Also asModule seems to have stopped generating valid modules since the last time I've tried it. I keep getting this error when importing a generated file:
>
> arithmetic.d(44): Error: undefined identifier module arithmetic.empty
> arithmetic.d(31): called from here:
> parse(Input(input,Pos(0u,0u,0u),AssociativeList(null)))
> simpleTest.d(30): called from here: parse("2/(8*7988+1*6196-y)")
> Failed: "dmd" "-w" "-wi" "-v" "-o-" "simpleTest.d" "-I."
Ah, I'm preparing a future switch to ranges and changed 'arr.length == 0' calls to 'arr.empty'. I forgot to put an 'import std.array;' at the beginning of 'asModule()( I guess.
OK, it's done and on Github. Thanks for the headup!
|
March 28, 2012 Re: Pegged: Syntax Highlighting | ||||
---|---|---|---|---|
| ||||
On 3/28/12, Philippe Sigaud <philippe.sigaud@gmail.com> wrote:
> OK, it's done and on Github. Thanks for the headup!
Cool, thanks for the quick fixes!
I see that each child in the parse tree has a begin/end position mark, this seems to be exactly what I need for syntax highlighting. I'll try have some fun with it.
|
March 29, 2012 Re: Pegged: Syntax Highlighting | ||||
---|---|---|---|---|
| ||||
On 3/28/12, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> On 3/28/12, Philippe Sigaud <philippe.sigaud@gmail.com> wrote:
>> OK, it's done and on Github. Thanks for the headup!
I've more to report :)
I don't know exactly which files I need to compile Pegged as a library. Which files are essential and which can be left out? I know utils.manual doesn't need to be included, but there's utils.bootstrap which has a wrong import to pegged.utils.PEgrammar (I think it should be pegged.utils.PEGGEDgrammar), and this statement "enum PEGCode = grammar(PEG);" should probably be "enum PEGCode = grammar(PEGGEDgrammar)".
Still if I try to compile all the modules I get an out of memory error from DMD.
|
Copyright © 1999-2021 by the D Language Foundation