All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snapscript.parse.SpaceGrammar Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.parse;

public class SpaceGrammar implements Grammar {

   private final GrammarMatcher matcher;
   
   public SpaceGrammar() {
      this.matcher = new SpaceMatcher();
   }
   
   @Override
   public GrammarMatcher create(GrammarCache cache, int length) {
      return matcher;
   } 
   
   private static class SpaceMatcher implements GrammarMatcher {
      
      @Override
      public boolean check(SyntaxChecker checker, int depth) {
         return checker.space();
      }
      
      @Override
      public boolean build(SyntaxBuilder builder, int depth) {
         return builder.space();
      }
      
      @Override
      public String toString() {
         return "_";
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy