{"id":16625467,"url":"https://github.com/aleclarson/sql-ast","last_synced_at":"2025-03-01T20:31:07.717Z","repository":{"id":57368175,"uuid":"144311240","full_name":"aleclarson/sql-ast","owner":"aleclarson","description":"MySQL parser","archived":false,"fork":false,"pushed_at":"2019-03-30T04:48:33.000Z","size":36,"stargazers_count":10,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T07:57:27.675Z","etag":null,"topics":["ast","lexer","mysql","parser"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aleclarson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-10T16:48:57.000Z","updated_at":"2024-02-11T14:49:51.000Z","dependencies_parsed_at":"2022-09-05T20:51:05.712Z","dependency_job_id":null,"html_url":"https://github.com/aleclarson/sql-ast","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fsql-ast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fsql-ast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fsql-ast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fsql-ast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleclarson","download_url":"https://codeload.github.com/aleclarson/sql-ast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":220108516,"owners_count":16595795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","lexer","mysql","parser"],"created_at":"2024-10-12T04:05:47.624Z","updated_at":"2024-10-17T16:57:28.667Z","avatar_url":"https://github.com/aleclarson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sql-ast v0.3.0\n\nThe current goal of `sql-ast` is to parse the output of `mysqldump` into an AST.\nIf anyone wants to expand the capability of this library, feel free to send some\npull requests!\n\n```js\nconst {parse} = require('sql-ast');\n\nparse(input); // =\u003e [object Array]\n```\n\n*Note:* The current feature set is very limited. Open an issue if you have want\nsomething that isn't supported yet.\n\n\u0026nbsp;\n\n### Whitespace\n\nTokens are *not* created for whitespace.\n\nThis includes spaces, tabs (`\\t`), line breaks (`\\n`), and carriage returns (`\\r`).\n\n### Comments\n\nTokens are *not* created for comments.\n\nAll three styles are supported: `/*`, `--`, and `#`.\n\nOne exception is `/*!`-style comments, which annotate the minimum MySQL version\nrequired to run the statement(s) or apply the attribute(s) contained within.\nSpecial `version` tokens are created for these comments.\n\n\u0026nbsp;\n\n### Token types\n\n- `word` is a character group matching `/^[a-z0-9_$]+$/i`\n- `ident` is a character group wrapped with backtick quotes\n- `punct` is a character matching `/^[(),.;=]$/`\n- `string` is a character group wrapped with single or double quotes\n- `number` is a character group matching `/^-?[0-9]+(\\.[0-9]+)?(E-?[0-9]+)?$/`\n- `variable` is a character group matching `/^@@?[$._a-z]+$/i`\n- `version` is a `/*!`-style comment or its `*/` closer\n\nEvery token has these properties:\n- `type: string`\n- `value: string|number`\n- `start: number`\n- `end: number`\n\n#### Notes\n- The `value` of a `number` is a number literal.\n- The `value` of a `ident` or `string` does not include the quotes.\n- The `value` of a `version` tells you the minimum MySQL version required\n  before any following tokens can be used. This remains in effect until another\n  `version` token is found.\n- When the `value` of a `version` token is:\n  - `\u003e 0` a minimum version of MySQL is required\n  - `== 0` no minimum version, but MySQL is required\n  - `== -1` MySQL is *not* required\n\n\u0026nbsp;\n\n### AST Nodes\n\nEvery AST node extends the `Node` class and has `start` and `end` properties.\n\n`Action` nodes are typically owned by statements that perform actions (eg: `ALTER`).\n\n`Attribute` nodes are typically owned by statements, column definitions, and index\ndefinitions. Some examples are `IF EXISTS` and `ENGINE=ISAM`.\n\n`Column` and `Index` nodes are owned by `CREATE TABLE` statements.\n\n`Literal` and `Variable` nodes are created for value expressions.\n\n`Variable` nodes are also created when a `SET` statement sets a variable.\nIn this case, the node has a `value` property.\n\n`Row` nodes are owned by `INSERT` and `REPLACE` statements.\n\n`Statement` nodes only exist in the top-level array returned by `parse`.\n\n#### Notes\n- All node types are exported by the main module.\n- They have no methods by default. Feel free to define methods as you see fit.\n- More node types may be added in the future.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fsql-ast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleclarson%2Fsql-ast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fsql-ast/lists"}