mirror of
https://github.com/DanilaFe/abacus
synced 2026-01-29 01:55:19 +00:00
Implement a few nodes for the pattern matching.
This commit is contained in:
18
src/org/nwapw/abacus/lexing/pattern/RangeNode.java
Normal file
18
src/org/nwapw/abacus/lexing/pattern/RangeNode.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package org.nwapw.abacus.lexing.pattern;
|
||||
|
||||
public class RangeNode<T> extends PatternNode<T> {
|
||||
|
||||
private char from;
|
||||
private char to;
|
||||
|
||||
public RangeNode(char from, char to){
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(char other) {
|
||||
return other >= from && other <= to;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user