@@ -0,0 +1,3398 @@
+/* This file is part of SableCC ( http://sablecc.org ).%0A *%0A * See the NOTICE file distributed with this work for copyright information.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.sablecc.sablecc.automaton.globalTests;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport org.junit.Test;%0Aimport org.sablecc.sablecc.alphabet.AdjacencyRealm;%0Aimport org.sablecc.sablecc.alphabet.Realms;%0Aimport org.sablecc.sablecc.automaton.Dfa;%0Aimport org.sablecc.sablecc.automaton.MinimalDfa;%0Aimport org.sablecc.sablecc.automaton.Nfa;%0A%0Apublic class commentsTest %7B%0A%0A    @Test%0A    public void commentTest() %7B%0A%0A        AdjacencyRealm%3CCharacter%3E charRealm = Realms.getCharacter();%0A%0A        // Building Nfa instances for differents useful intervals%0A        Nfa%3CCharacter%3E any = new Nfa%3CCharacter%3E(charRealm.createInterval('#',%0A                '%7D'));%0A        Nfa%3CCharacter%3E slash = new Nfa%3CCharacter%3E(charRealm.createInterval('/'));%0A        Nfa%3CCharacter%3E star = new Nfa%3CCharacter%3E(charRealm.createInterval('*'));%0A        Nfa%3CCharacter%3E noStar = new Nfa%3CCharacter%3E(charRealm.createInterval(%0A                '#', ')')).unionWith(new Nfa%3CCharacter%3E(charRealm%0A                .createInterval('+', '%7D')));%0A        Nfa%3CCharacter%3E noStarOrSlash = new Nfa%3CCharacter%3E(charRealm%0A                .createInterval('#', ')')).unionWith(%0A                new Nfa%3CCharacter%3E(charRealm.createInterval('+', '.')))%0A                .unionWith(%0A                        new Nfa%3CCharacter%3E(charRealm.createInterval('0', '%7D')));%0A%0A        // Building minimal dfa comment using method shortest%0A        Nfa%3CCharacter%3E comment = new Nfa%3CCharacter%3E();%0A        comment = slash.concatenateWith(star).concatenateWith(any.oneOrMore())%0A                .concatenateWith(star).concatenateWith(slash);%0A        Dfa%3CCharacter%3E shortestComment = comment.shortest();%0A        MinimalDfa%3CCharacter%3E minimalDfaShortestComment = new MinimalDfa%3CCharacter%3E(%0A                shortestComment);%0A%0A        // Building minimal dfa comment by construction%0A        Nfa%3CCharacter%3E constructionComment = new Nfa%3CCharacter%3E();%0A        constructionComment = slash.concatenateWith(star).concatenateWith(%0A                noStar.oneOrMore()).concatenateWith(%0A                star.concatenateWith(%0A                        noStarOrSlash.concatenateWith(noStar.oneOrMore()))%0A                        .zeroOrOne()).oneOrMore().concatenateWith(star)%0A                .concatenateWith(slash);%0A        Dfa%3CCharacter%3E constructedDfaComment = new Dfa%3CCharacter%3E(%0A                constructionComment);%0A        MinimalDfa%3CCharacter%3E minimalDfaConstructionComment = new MinimalDfa%3CCharacter%3E(%0A                constructedDfaComment);%0A%0A        // Testing for equality between the 2 minimalDfa for equivalent Dfa%0A        assertEquals(%22The two minimal Dfa insstances should be equals.%22,%0A                minimalDfaConstructionComment, minimalDfaShortestComment);%0A    %7D%0A%7D%0A

Add global test for automaton package.