N NezamDocumentation

Literal grammar#

Literal grammar describes strings, numbers, booleans, nulls, arrays, maps, date-like values, money values, and structured literals.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/literal.g4
Grammar nameliteral
Grammar kindparser
Importscommon
Imported byapi, app, BusinessLanguage, class, controls, enum, errorHandling, expression, field, form, function, interface, message, module, program, query, service, source_ui, subscription, table, type, validation
Direct rule or token count22

How to use this page#

Read the examples first when authoring Business Language. Use the rule inventory when checking exact grammar coverage or when updating parser, lowering, editor, or documentation behavior.

Entry rules and syntax families#

Start with these rules when reading this grammar: literal, stringLiteral, integerLiteral, floatLiteral, booleanLiteral, nullLiteral, arrayLiteral, objectLiteral, percentageLiteral, dateLiteral.

  • Literals: arrayLiteral, booleanLiteral, dateLiteral, floatLiteral, integerLiteral, nullLiteral, numericLiteral, objectLiteral, and 4 more

Key grammar excerpts#

literal#

antlr
literal: stringLiteral
       | percentageLiteral
       | integerLiteral
       | floatLiteral
       | booleanLiteral
       | nullLiteral
       | arrayLiteral
       | objectLiteral
       | dateLiteral
       | timeLiteral
       | templateLiteral
       // TODO: Restore regexLiteral once lexer-level regex mode returns; current lexer

stringLiteral#

antlr
stringLiteral: STRING_LITERAL
             | DOUBLE_QUOTE_STRING
             | SINGLE_QUOTE_STRING
             | TEMPLATE_STRING
             | BACKTICK_STRING
             | STRING
             ;

integerLiteral#

antlr
integerLiteral: DECIMAL_INTEGER
              | INTEGER_LITERAL
              | HEX_INTEGER
              | OCTAL_INTEGER
              | BINARY_INTEGER
              ;

Complete rule and token inventory#

text
arrayElement, arrayLiteral, booleanLiteral, computedPropertyKey, dateLiteral, floatLiteral, integerLiteral, literal
nullLiteral, numericLiteral, objectLiteral, objectValue, percentageLiteral, propertyAssignment, propertyName, propertySeparator
propertySpread, spreadElement, stringLiteral, templateElement, templateLiteral, timeLiteral

Examples#

Scalar literals#

bl
var enabled: bool = true;
var page_size: int = 25;
var label: string = "Payables";

Collection literals#

bl
var labels = ["Payables", "Receivables"];
var sample_amounts = { net: 1000.00, tax: 150.00 };

Common authoring mistakes#

  • Do not copy examples without checking the rule inventory for the exact grammar boundary.
  • Do not add behavior that depends on missing configuration or undeclared user-facing errors.
  • /language/types-literals/
  • /language/expressions/

Authoring notes#

  • Keep examples aligned with the grammar source, not with inferred syntax from another language.
  • Use declared messages for user-facing failures, and fail closed when required configuration is absent.
Source: packages/business/language/grammar-files/literal.md