chore: update name

This commit is contained in:
Chen Asraf
2022-08-16 02:16:48 +03:00
parent a83b6d87c9
commit 2607e84b18
3 changed files with 16 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
<h1>Search Query AST for JS</h1>
<h1>Search Query Parser for JS</h1>
This is a package for JS applications that parses search queries with the common search operator
features such as logical or/and, grouping, phrases (in quotes), etc.
@@ -6,6 +6,8 @@ features such as logical or/and, grouping, phrases (in quotes), etc.
This package **does not** implement a search mechanism using the resulting tree, that is up to the
package user (you). It only returns the logical tree of search.
---
<!-- toc -->
<details>
<summary>Table of contents</summary>
@@ -91,7 +93,7 @@ const result = [
Simply pass a string to the parse to get the result.
```js
import { parse } from 'search-query-ast'
import { parse } from 'search-query-parser'
const result = parse('(mango banana lemon) OR apple -pineapple')
```

View File

@@ -1,9 +1,9 @@
{
"name": "search-query-ast",
"name": "search-query-parser",
"version": "0.1.0",
"description": "Parses search query syntax into AST tree",
"main": "index.js",
"repository": "https://github.com/chenasraf/search-query-ast-js",
"repository": "https://github.com/chenasraf/search-query-parser-js",
"author": "Chen Asraf <contact@casraf.dev>",
"license": "MIT",
"private": false,

View File

@@ -0,0 +1,10 @@
import { Lexer } from './lexer'
import { Parser, ParserToken } from './parser'
import { StringReader } from './reader'
export function parse(search: string): ParserToken[] {
const reader = new StringReader(search)
const lexer = new Lexer(reader)
const parser = new Parser(lexer)
return parser.parse()
}