Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit60774e8

Browse files
committed
Even better example for operator precedence mis-parsing.
1 parent2a39872 commit60774e8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎doc/src/sgml/syntax.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.40 2001/02/24 18:09:51 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.41 2001/02/25 16:05:21 petere Exp $
33
-->
44

55
<chapter id="sql-syntax">
@@ -905,17 +905,17 @@ sqrt(2)
905905
you will sometimes need to add parentheses when using combinations
906906
of binary and unary operators. For instance
907907
<programlisting>
908-
SELECT 5 !+ 6;
908+
SELECT 5 !- 6;
909909
</programlisting>
910910
will be parsed as
911911
<programlisting>
912-
SELECT 5 ! (+ 6);
912+
SELECT 5 ! (- 6);
913913
</programlisting>
914914
because the parser has no idea -- until it is too late -- that
915915
<token>!</token> is defined as a postfix operator, not an infix one.
916916
To get the desired behavior in this case, you must write
917917
<programlisting>
918-
SELECT (5 !)+ 6;
918+
SELECT (5 !)- 6;
919919
</programlisting>
920920
This is the price one pays for extensibility.
921921
</para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp