Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

Lexical elements

Fauna Query Language (FQL) supports UTF-8 encoded Unicode text.

This section covers the basic character set, whitespace, line termination, and comments syntax elements.

Character set

FQL supports the following character set:

a b c d e f g h i j k l m n o p q r s t u v w x y z

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

0 1 2 3 4 5 6 7 8 9

$ ! % & ( ) * + , - . / : ; < = > ? @ [ ] ^ _ { | } ~ `

Schema entity naming might impose added restrictions on the allowed character set.

Whitespace

Whitespace may be used between FQL tokens and are ignored by the parse. Whitespace is a nonempty sequence of any of the following characters, as listed in the ECMAScript Language Specification:

Unicode code point Description Escape sequence

U+0009

Character tab

\t

U+000B

Line tab

\v

U+000C

Form feed

\f

U+0020

Space

U+00A0

No-break space

U+FEFF

Zero-width no-break space

Line termination and block-style comments are also treated as whitespace and can be used anywhere whitespace can be used.

Line terminators

Line terminators can be used where permitted by the syntactic grammar, which is wherever whitespace is allowed.

The following table lists the recognized line termination characters:

Unicode code point Description Escape sequence

U+000A

Line feed

\n

U+000D

Carriage return

\r

U+2028

Line separator

U+2029

Paragraph separator

Escaped characters

Use a backslash (\) to escape a character in a String:

Escape sequence Escaped character

\0

null

\'

single quote

\"

double quote

\`

backtick

\#

number symbol

\b

backspace

\t

horizontal tab

\n

line feed, new line

\v

vertical tab

\f

form feed

\r

carriage return

\\

backslash

\xhh

character represented by the hexadecimal value hh

\uhhhh

character represented by the Unicode code point hhhh

\u{hh…​}

character represented by the arbitrary Unicode code point hh…​

Comments

FQL supports single-line and block comments.

  • Single-line Comments

    The // character sequence starts a single-line comment. A line feed terminates the comment.

    // This is a single-line comment
    
    "String" // This comment annotates a line
  • Block Comments

    A block comment can be used where whitespace is permitted.

    The /* character sequence starts a block comment. The comment is terminated by the matching */ character sequence. A block comment can span multiple lines and block comments can be nested.

    /* This block comment is on one line */
    
    "String" /* This comment annotates a line */
    
    /*  This comment spans
        multiple lines */
    
    /*
      This comment spans
      multiple lines.
      /*
        This block comment is nested within a block comment.
      */
    */

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!