-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from caido/ef-source
Source namespace
- Loading branch information
Showing
16 changed files
with
132 additions
and
16 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@caido/httpql", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Parser for the HTTPQL language", | ||
"author": "Caido Labs Inc. <[email protected]>", | ||
"license": "MIT", | ||
|
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,25 @@ | ||
import type { SyntaxNode } from "@lezer/common"; | ||
import { err, type Result } from "neverthrow"; | ||
|
||
import { type HTTPQLError, InvalidQuery } from "../errors.js"; | ||
import { terms } from "../parser/index.js"; | ||
import type { ExprSource } from "../primitives.js"; | ||
import { isPresent } from "../utils.js"; | ||
|
||
import { deserializeString } from "./string.js"; | ||
|
||
export const deserializeSourceQuery = ( | ||
node: SyntaxNode, | ||
doc: string, | ||
): Result<ExprSource, HTTPQLError> => { | ||
const nameNode = node.getChild(terms.SourceNameExpression); | ||
if (isPresent(nameNode)) { | ||
return deserializeString(nameNode, doc).map(({ value }) => { | ||
return { | ||
name: value, | ||
}; | ||
}); | ||
} | ||
|
||
return err(new InvalidQuery()); | ||
}; |
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
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
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ authors = ["Caido Labs Inc. <[email protected]>"] | |
description = "Parser for the HTTPQL language" | ||
repository = "https://github.com/caido/httpql" | ||
license = "MIT" | ||
version = "0.3.0" | ||
version = "0.4.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
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.