Feature: Tokenize String Literals #5

Closed
opened 2023-09-22 00:01:43 +00:00 by j · 1 comment
Owner

Feature Progress

  • Create string literal types
  • Define rule for tokenizing string literals

Feature description

A string literal is:

  • Quote "
  • Optional sequence of any:
    • Arbitrary non-", non-escape character
    • Escape sequence
  • Quote "

An escape sequence represents a character that's disallowed in string literals.
An escape sequence is:

  • An escape character \
  • An escape specifier [", ...]
    • Other escape characters should be added when necessary

Example

// This is an empty string literal
""
// This string literal has characters inside it
"I love 🦅 and 🦈"
// This string literal has an escape sequence
"Here's an important quote: \" "
# Feature Progress <!-- Describe the steps for implementing this feature in libconlang --> - [x] Create string literal types - [x] Define rule for tokenizing string literals # Feature description A string literal is: - Quote `"` - Optional sequence of any: - Arbitrary non-`"`, non-escape character - Escape sequence - Quote `"` An escape sequence represents a character that's disallowed in string literals. An escape sequence is: - An escape character `\` - An escape specifier [`"`, ...] - Other escape characters should be added when necessary # Example <!-- Demonstrate this feature with a clear, concise code example Right now, we're (ab)using Rust syntax highlighting, since it most closely matches what I'm currently aiming for --> ```rust // This is an empty string literal "" // This string literal has characters inside it "I love 🦅 and 🦈" // This string literal has an escape sequence "Here's an important quote: \" " ```
j added the
enhancement
label 2023-09-22 00:01:43 +00:00
j added this to the Basic Syntax project 2023-09-22 00:01:43 +00:00
j changed title from Feature: String Literals to Feature: Tokenize String Literals 2023-09-23 05:19:33 +00:00
j added a new dependency 2023-09-23 05:40:41 +00:00
Author
Owner

Further transformation by the parser will be required to interpret escape sequences.

Further transformation by the parser will be required to interpret escape sequences.
j closed this issue 2023-09-25 18:21:43 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Blocks
Reference: j/Conlang#5
No description provided.