Okay, but the code to do that is simple to write and easier to read, so I
don't get why you didn't do it that way first. Then we wouldn't need to
refactor it. So, once I'm done with the fire draft of this review, do that
refactoring now. It shouldn't take too long, no more than a day at most.
On Mar 28, 2014 12:26 PM, "Radu Mereuta" <notifications@github.com> wrote:

> In src/javasources/KTool/src/org/kframework/parser/concrete2/Grammar.java:
>
> > +            for (State s : nonTerminal.getReachableStates()) {
> > +                if (s instanceof PrimitiveState) {
> > +                    PrimitiveState ps = ((PrimitiveState) s);
> > +                    PrimitiveState whitespace = new RegExState(
> > +                        new StateId("whitespace" + seed++), s.nt, pattern, KSorts.K);
> > +                    RuleState deleteToken = new RuleState(
> > +                        new StateId("whitespace-D-" + seed++), s.nt, new DeleteRule(1, true));
> > +                    whitespace.next.add(deleteToken);
> > +                    deleteToken.next.addAll(ps.next);
> > +                    ps.next.clear();
> > +                    ps.next.add(whitespace);
> > +                }
> > +            }
> > +        }
> > +        // create a new state for every start state that can have whitespace at the beginning
> > +        for (Entry<NonTerminalId, NonTerminal> entry : startNonTerminals.entrySet()) {
>
> If you look at the second TODO in this function, this is exactly what I
> want to do when I refactor whitespaces.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/kframework/k/pull/318/files#r11076163>
> .
>