-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for fragments (#21)
- Loading branch information
Showing
9 changed files
with
204 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { identifiers, utilities } from '#apg-lite'; | ||
|
||
const fragmentMarker = (state, chars, phraseIndex, phraseLength, data) => { | ||
if (state === identifiers.SEM_PRE) { | ||
data.push(['fragment-marker', utilities.charsToString(chars, phraseIndex, phraseLength)]); | ||
} else if (state === identifiers.SEM_POST) { | ||
/* not used in this example */ | ||
} | ||
return identifiers.SEM_OK; | ||
}; | ||
|
||
export default fragmentMarker; |
6 changes: 3 additions & 3 deletions
6
src/parse/callbacks/query-literal.js → src/parse/callbacks/fragment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { identifiers, utilities } from '#apg-lite'; | ||
|
||
const queryLiteral = (state, chars, phraseIndex, phraseLength, data) => { | ||
const fragment = (state, chars, phraseIndex, phraseLength, data) => { | ||
if (state === identifiers.SEM_PRE) { | ||
data.push(['query-literal', utilities.charsToString(chars, phraseIndex, phraseLength)]); | ||
data.push(['fragment', utilities.charsToString(chars, phraseIndex, phraseLength)]); | ||
} else if (state === identifiers.SEM_POST) { | ||
/* not used in this example */ | ||
} | ||
return identifiers.SEM_OK; | ||
}; | ||
|
||
export default queryLiteral; | ||
export default fragment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.