Skip to content

Commit

Permalink
Fix parser errors due to missing space. Close #3 and Controlling#162
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredlll08 committed Apr 23, 2024
1 parent b55f408 commit 7c59e21
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ private Expression literal() {

if(match(TokenType.STRING)) {
Token previous = previous();
return new LiteralExpression(previous.literal(), previous.lexeme());
LiteralExpression literalExpression = new LiteralExpression(previous.literal(), previous.lexeme());
if(!check(TokenType.SPACE) && !isAtEnd()) {
return new PairedExpression(literalExpression, expression());
}
return literalExpression;
}

return new LiteralExpression("", "");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.blamejared.searchables.tests;

import com.blamejared.searchables.TestConstants;
import com.blamejared.searchables.api.TokenRange;
import com.blamejared.searchables.api.autcomplete.CompletionVisitor;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -107,4 +109,12 @@ public void testOneEmptyComponentSearchOrderTwo() {
assertThat(shapes, contains(TestConstants.Shapes.ONE, TestConstants.Shapes.FIVE, TestConstants.Shapes.NINE));
}

@Test
public void testQuotes() {

String search = "name:`on`a";
List<TestConstants.Shape> shapes = TestConstants.SHAPE.filterEntries(TestConstants.SHAPES, search);
assertThat(shapes, contains(TestConstants.SHAPES.toArray(TestConstants.Shape[]::new)));
}

}

0 comments on commit 7c59e21

Please sign in to comment.