Variable: sqlind-indentation-syntax-symbols
sqlind-indentation-syntax-symbols is a variable defined in
sql-indent.el.
Value
nil
Documentation
This variable exists just for its documentation.
The the SQL parsing code returns a syntax definition (either a
symbol or a list) and an anchor point, which is a buffer
position. The syntax symbols can be used to define how to indent
each line, see sqlind-indentation-offsets-alist
The following syntax symbols are defined for SQL code:
- (syntax-error MESSAGE START END) -- this is returned when the
parse failed. MESSAGE is an informative message, START and END
are buffer locations denoting the problematic region. ANCHOR
is undefined for this syntax info
- in-comment -- line is inside a multi line comment, ANCHOR is
the start of the comment.
- comment-start -- line starts with a comment. ANCHOR is the
start of the enclosing block.
- in-string -- line is inside a string, ANCHOR denotes the start
of the string.
- toplevel -- line is at toplevel (not inside any programming
construct). ANCHOR is usually (point-min).
- (in-block BLOCK-KIND LABEL) -- line is inside a block
construct. BLOCK-KIND (a symbol) is the actual block type and
can be one of "if", "case", "exception", "loop" etc.
If the block is labeled, LABEL contains the label. ANCHOR is
the start of the block.
- (in-begin-block KIND LABEL) -- line is inside a block started
by a begin statement. KIND (a symbol) is "toplevel-block"
for a begin at toplevel, "defun" for a begin that starts the
body of a procedure or function, "package" for a begin that
starts the body of a package, or nil for a begin that is none
of the previous. For a "defun" or "package", LABEL is the
name of the procedure, function or package, for the other block
types LABEL contains the block label, or the empty string if
the block has no label. ANCHOR is the start of the block.
- (block-start KIND) -- line begins with a statement that starts
a block. KIND (a symbol) can be one of "then", "else" or
"loop". ANCHOR is the reference point for the block
start (the coresponding if, case, etc).
- (block-end KIND LABEL) -- the line contains an end statement.
KIND (a symbol) is the type of block we are closing, LABEL (a
string) is the block label (or procedure name for an end
defun).
- declare-statement -- line is after a declare keyword, but
before the begin. ANCHOR is the start of the declare
statement.
- (package NAME) -- line is inside a package definition. NAME is
the name of the package, ANCHOR is the start of the package.
- (package-body NAME) -- line is inside a package body. NAME is
the name of the package, ANCHOR is the start of the package
body.
- (create-statement WHAT NAME) -- line is inside a CREATE
statement (other than create procedure or function). WHAT is
the thing being created, NAME is its name. ANCHOR is the start
of the create statement.
- (defun-start NAME) -- line is inside a procedure of function
definition but before the begin block that starts the body.
NAME is the name of the procedure/function, ANCHOR is the start
of the procedure/function definition.
The following SYNTAX-es are for SQL statements. For all of them ANCHOR points to the start of a statement itself.
- labeled-statement-start -- line is just after a label.
- statement-continuation -- line is inside a statement which
starts on a previous line.
- nested-statement-open -- line is just inside an opening
bracket, but the actual bracket is on a previous line.
- nested-statement-continuation -- line is inside an opening
bracket, but not the first element after the bracket.
- nested-statement-close -- line is inside an opening bracket and
the line contains the closing bracket as the first character.
The following SYNTAX-es are for statements which are SQL code (DML statements). They are pecialisations on the previous statement syntaxes and for all of them a previous generic statement syntax is present earlier in the SYNTAX list. Unless otherwise specified, ANCHOR points to the start of the clause (select, from, where, etc) in which the current point is.
- with-clause -- line is inside a WITH clause, but before the
main SELECT clause.
- with-clause-cte -- line is inside a with clause before a
CTE (common table expression) declaration
- with-clause-cte-cont -- line is inside a with clause before a
CTE definition
- case-clause -- line is on a CASE expression (WHEN or END
clauses). ANCHOR is the start of the CASE expression.
- case-clause-item -- line is on a CASE expression (THEN and ELSE
clauses). ANCHOR is the position of the case clause.
- case-clause-item-cont -- line is on a CASE expression but not
on one of the CASE sub-keywords. ANCHOR points to the case
keyword that this line is a continuation of.
- select-clause -- line is inside a select statement, right
before one of its clauses (from, where, order by, etc).
- select-column -- line is inside the select column section,
after a full column was defined (and a new column definition is
about to start).
- select-column-continuation -- line is inside the select column
section, but in the middle of a column definition. The defined
column starts on a previous like. Note that ANCHOR still
points to the start of the select statement itself.
- select-join-condition -- line is right before or just after the ON clause
for an INNER, LEFT or RIGHT join. ANCHOR points to the join statement
for which the ON is defined.
- select-table -- line is inside the from clause, just after a
table was defined and a new one is about to start.
- select-table-continuation -- line is inside the from clause,
inside a table definition which starts on a previous line. Note
that ANCHOR still points to the start of the select statement
itself.
- (in-select-clause CLAUSE) -- line is inside the select CLAUSE,
which can be "where", "order by", "group by" or
"having". Note that CLAUSE can never be "select" and
"from", because we have special syntaxes inside those
clauses.
- insert-clause -- line is inside an insert statement, right
before one of its clauses (values, select).
- (in-insert-clause CLAUSE) -- line is inside the insert CLAUSE,
which can be "insert into" or "values".
- delete-clause -- line is inside a delete statement right before
one of its clauses.
- (in-delete-clause CLAUSE) -- line is inside a delete CLAUSE,
which can be "delete from" or "where".
- update-clause -- line is inside an update statement right
before one of its clauses.
- (in-update-clause CLAUSE) -- line is inside an update CLAUSE,
which can be "update", "set" or "where".
Source Code
;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
(defvar sqlind-indentation-syntax-symbols '()
"This variable exists just for its documentation.
The the SQL parsing code returns a syntax definition (either a
symbol or a list) and an anchor point, which is a buffer
position. The syntax symbols can be used to define how to indent
each line, see `sqlind-indentation-offsets-alist'
The following syntax symbols are defined for SQL code:
- (syntax-error MESSAGE START END) -- this is returned when the
parse failed. MESSAGE is an informative message, START and END
are buffer locations denoting the problematic region. ANCHOR
is undefined for this syntax info
- `in-comment' -- line is inside a multi line comment, ANCHOR is
the start of the comment.
- `comment-start' -- line starts with a comment. ANCHOR is the
start of the enclosing block.
- `in-string' -- line is inside a string, ANCHOR denotes the start
of the string.
- `toplevel' -- line is at toplevel (not inside any programming
construct). ANCHOR is usually (point-min).
- (in-block BLOCK-KIND LABEL) -- line is inside a block
construct. BLOCK-KIND (a symbol) is the actual block type and
can be one of \"if\", \"case\", \"exception\", \"loop\" etc.
If the block is labeled, LABEL contains the label. ANCHOR is
the start of the block.
- (in-begin-block KIND LABEL) -- line is inside a block started
by a begin statement. KIND (a symbol) is \"toplevel-block\"
for a begin at toplevel, \"defun\" for a begin that starts the
body of a procedure or function, \"package\" for a begin that
starts the body of a package, or nil for a begin that is none
of the previous. For a \"defun\" or \"package\", LABEL is the
name of the procedure, function or package, for the other block
types LABEL contains the block label, or the empty string if
the block has no label. ANCHOR is the start of the block.
- (block-start KIND) -- line begins with a statement that starts
a block. KIND (a symbol) can be one of \"then\", \"else\" or
\"loop\". ANCHOR is the reference point for the block
start (the coresponding if, case, etc).
- (block-end KIND LABEL) -- the line contains an end statement.
KIND (a symbol) is the type of block we are closing, LABEL (a
string) is the block label (or procedure name for an end
defun).
- declare-statement -- line is after a declare keyword, but
before the begin. ANCHOR is the start of the declare
statement.
- (package NAME) -- line is inside a package definition. NAME is
the name of the package, ANCHOR is the start of the package.
- (package-body NAME) -- line is inside a package body. NAME is
the name of the package, ANCHOR is the start of the package
body.
- (create-statement WHAT NAME) -- line is inside a CREATE
statement (other than create procedure or function). WHAT is
the thing being created, NAME is its name. ANCHOR is the start
of the create statement.
- (defun-start NAME) -- line is inside a procedure of function
definition but before the begin block that starts the body.
NAME is the name of the procedure/function, ANCHOR is the start
of the procedure/function definition.
The following SYNTAX-es are for SQL statements. For all of
them ANCHOR points to the start of a statement itself.
- labeled-statement-start -- line is just after a label.
- statement-continuation -- line is inside a statement which
starts on a previous line.
- nested-statement-open -- line is just inside an opening
bracket, but the actual bracket is on a previous line.
- nested-statement-continuation -- line is inside an opening
bracket, but not the first element after the bracket.
- nested-statement-close -- line is inside an opening bracket and
the line contains the closing bracket as the first character.
The following SYNTAX-es are for statements which are SQL
code (DML statements). They are pecialisations on the previous
statement syntaxes and for all of them a previous generic
statement syntax is present earlier in the SYNTAX list. Unless
otherwise specified, ANCHOR points to the start of the
clause (select, from, where, etc) in which the current point is.
- with-clause -- line is inside a WITH clause, but before the
main SELECT clause.
- with-clause-cte -- line is inside a with clause before a
CTE (common table expression) declaration
- with-clause-cte-cont -- line is inside a with clause before a
CTE definition
- case-clause -- line is on a CASE expression (WHEN or END
clauses). ANCHOR is the start of the CASE expression.
- case-clause-item -- line is on a CASE expression (THEN and ELSE
clauses). ANCHOR is the position of the case clause.
- case-clause-item-cont -- line is on a CASE expression but not
on one of the CASE sub-keywords. ANCHOR points to the case
keyword that this line is a continuation of.
- select-clause -- line is inside a select statement, right
before one of its clauses (from, where, order by, etc).
- select-column -- line is inside the select column section,
after a full column was defined (and a new column definition is
about to start).
- select-column-continuation -- line is inside the select column
section, but in the middle of a column definition. The defined
column starts on a previous like. Note that ANCHOR still
points to the start of the select statement itself.
- select-join-condition -- line is right before or just after the ON clause
for an INNER, LEFT or RIGHT join. ANCHOR points to the join statement
for which the ON is defined.
- select-table -- line is inside the from clause, just after a
table was defined and a new one is about to start.
- select-table-continuation -- line is inside the from clause,
inside a table definition which starts on a previous line. Note
that ANCHOR still points to the start of the select statement
itself.
- (in-select-clause CLAUSE) -- line is inside the select CLAUSE,
which can be \"where\", \"order by\", \"group by\" or
\"having\". Note that CLAUSE can never be \"select\" and
\"from\", because we have special syntaxes inside those
clauses.
- insert-clause -- line is inside an insert statement, right
before one of its clauses (values, select).
- (in-insert-clause CLAUSE) -- line is inside the insert CLAUSE,
which can be \"insert into\" or \"values\".
- delete-clause -- line is inside a delete statement right before
one of its clauses.
- (in-delete-clause CLAUSE) -- line is inside a delete CLAUSE,
which can be \"delete from\" or \"where\".
- update-clause -- line is inside an update statement right
before one of its clauses.
- (in-update-clause CLAUSE) -- line is inside an update CLAUSE,
which can be \"update\", \"set\" or \"where\".")