mirror of
https://github.com/ScintillaOrg/lexilla.git
synced 2025-05-08 19:06:45 +08:00
#287 Add SCE_ZIG_IDENTIFIER_STRING for identifiers expressed as strings.
See https://ziglang.org/documentation/0.13.0/#Identifiers
This commit is contained in:
parent
0882e4276c
commit
942ac3fed7
@ -614,6 +614,10 @@
|
||||
TOML: Don't treat keys without values as errors.
|
||||
<a href="https://github.com/ScintillaOrg/lexilla/pull/283">Pull request #283</a>.
|
||||
</li>
|
||||
<li>
|
||||
Zig: Add SCE_ZIG_IDENTIFIER_STRING for identifiers expressed as strings.
|
||||
<a href="https://github.com/ScintillaOrg/lexilla/pull/287">Pull request #287</a>.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="https://www.scintilla.org/lexilla541.zip">Release 5.4.1</a>
|
||||
|
@ -2425,6 +2425,7 @@ val SCE_ZIG_KW_PRIMARY=13
|
||||
val SCE_ZIG_KW_SECONDARY=14
|
||||
val SCE_ZIG_KW_TERTIARY=15
|
||||
val SCE_ZIG_KW_TYPE=16
|
||||
val SCE_ZIG_IDENTIFIER_STRING=17
|
||||
# Lexical states for SCLEX_NIX
|
||||
lex Nix=SCLEX_NIX SCE_NIX_
|
||||
val SCE_NIX_DEFAULT=0
|
||||
|
@ -2165,6 +2165,7 @@
|
||||
#define SCE_ZIG_KW_SECONDARY 14
|
||||
#define SCE_ZIG_KW_TERTIARY 15
|
||||
#define SCE_ZIG_KW_TYPE 16
|
||||
#define SCE_ZIG_IDENTIFIER_STRING 17
|
||||
#define SCE_NIX_DEFAULT 0
|
||||
#define SCE_NIX_COMMENTLINE 1
|
||||
#define SCE_NIX_COMMENTBLOCK 2
|
||||
|
@ -162,6 +162,7 @@ LexicalClass lexicalClasses[] = {
|
||||
14, "SCE_ZIG_KW_SECONDARY", "identifier", "Secondary keywords",
|
||||
15, "SCE_ZIG_KW_TERTIARY", "identifier", "Tertiary keywords",
|
||||
16, "SCE_ZIG_KW_TYPE", "identifier", "Global types",
|
||||
17, "SCE_ZIG_IDENTIFIER_STRING", "identifier", "Identifier using @\"\" syntax",
|
||||
};
|
||||
|
||||
class LexerZig : public DefaultLexer {
|
||||
@ -307,6 +308,7 @@ void LexerZig::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle
|
||||
case SCE_ZIG_CHARACTER:
|
||||
case SCE_ZIG_STRING:
|
||||
case SCE_ZIG_MULTISTRING:
|
||||
case SCE_ZIG_IDENTIFIER_STRING:
|
||||
if (sc.atLineStart) {
|
||||
sc.SetState(SCE_ZIG_DEFAULT);
|
||||
} else if (sc.ch == '\\' && sc.state != SCE_ZIG_MULTISTRING) {
|
||||
@ -318,16 +320,9 @@ void LexerZig::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle
|
||||
escSeq.digitsLeft = 9;
|
||||
sc.Forward();
|
||||
}
|
||||
} else if ((sc.ch == '\'' && sc.state == SCE_ZIG_CHARACTER) || (sc.ch == '\"' && sc.state == SCE_ZIG_STRING)) {
|
||||
} else if ((sc.ch == '\'' && sc.state == SCE_ZIG_CHARACTER) ||
|
||||
(sc.ch == '\"' && (sc.state == SCE_ZIG_STRING || sc.state == SCE_ZIG_IDENTIFIER_STRING))) {
|
||||
sc.ForwardSetState(SCE_ZIG_DEFAULT);
|
||||
} else if (sc.state != SCE_ZIG_CHARACTER) {
|
||||
if (sc.ch == '{' || sc.ch == '}') {
|
||||
if (sc.ch == sc.chNext) {
|
||||
escSeq.resetEscapeState(sc.state);
|
||||
sc.SetState(SCE_ZIG_ESCAPECHAR);
|
||||
sc.Forward();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -373,6 +368,9 @@ void LexerZig::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle
|
||||
sc.SetState(SCE_ZIG_NUMBER);
|
||||
} else if ((sc.ch == '@' && IsIdentifierStartEx(sc.chNext)) || IsIdentifierStartEx(sc.ch)) {
|
||||
sc.SetState((sc.ch == '@') ? SCE_ZIG_BUILTIN_FUNCTION : SCE_ZIG_IDENTIFIER);
|
||||
} else if (sc.ch == '@' && sc.chNext == '"') {
|
||||
sc.SetState(SCE_ZIG_IDENTIFIER_STRING);
|
||||
sc.Forward();
|
||||
} else if (IsAGraphic(sc.ch)) {
|
||||
sc.SetState(SCE_ZIG_OPERATOR);
|
||||
}
|
||||
|
@ -275,3 +275,16 @@ const optional_value: ?i32 = null;
|
||||
//! This module provides functions for retrieving the current date and
|
||||
//! time with varying degrees of precision and accuracy. It does not
|
||||
//! depend on libc, but will use functions from it if available.
|
||||
|
||||
const @"identifier with spaces in it" = 0xff;
|
||||
const @"1SmallStep4Man" = 112358;
|
||||
|
||||
const c = @import("std").c;
|
||||
pub extern "c" fn @"error"() void;
|
||||
pub extern "c" fn @"fstat$INODE64"(fd: c.fd_t, buf: *c.Stat) c_int;
|
||||
|
||||
const Color = enum {
|
||||
red,
|
||||
@"really red",
|
||||
};
|
||||
const color: Color = .@"really red";
|
||||
|
@ -275,4 +275,17 @@
|
||||
2 400 401 + //! This module provides functions for retrieving the current date and
|
||||
0 401 401 | //! time with varying degrees of precision and accuracy. It does not
|
||||
0 401 400 | //! depend on libc, but will use functions from it if available.
|
||||
0 400 400
|
||||
0 400 400 const @"identifier with spaces in it" = 0xff;
|
||||
0 400 400 const @"1SmallStep4Man" = 112358;
|
||||
0 400 400
|
||||
0 400 400 const c = @import("std").c;
|
||||
0 400 400 pub extern "c" fn @"error"() void;
|
||||
0 400 400 pub extern "c" fn @"fstat$INODE64"(fd: c.fd_t, buf: *c.Stat) c_int;
|
||||
0 400 400
|
||||
2 400 401 + const Color = enum {
|
||||
0 401 401 | red,
|
||||
0 401 401 | @"really red",
|
||||
0 401 400 | };
|
||||
0 400 400 const color: Color = .@"really red";
|
||||
0 400 0
|
@ -275,3 +275,16 @@
|
||||
{3}//! This module provides functions for retrieving the current date and
|
||||
//! time with varying degrees of precision and accuracy. It does not
|
||||
//! depend on libc, but will use functions from it if available.
|
||||
{0}
|
||||
{13}const{0} {17}@"identifier with spaces in it"{0} {5}={0} {4}0xff{5};{0}
|
||||
{13}const{0} {17}@"1SmallStep4Man"{0} {5}={0} {4}112358{5};{0}
|
||||
|
||||
{13}const{0} {10}c{0} {5}={0} {12}@import{5}({7}"std"{5}).{10}c{5};{0}
|
||||
{13}pub{0} {13}extern{0} {7}"c"{0} {13}fn{0} {17}@"error"{5}(){0} {11}void{5};{0}
|
||||
{13}pub{0} {13}extern{0} {7}"c"{0} {13}fn{0} {17}@"fstat$INODE64"{5}({11}fd{5}:{0} {10}c{5}.{10}fd_t{5},{0} {10}buf{5}:{0} {5}*{10}c{5}.{10}Stat{5}){0} {10}c_int{5};{0}
|
||||
|
||||
{13}const{0} {10}Color{0} {5}={0} {13}enum{0} {5}{{0}
|
||||
{10}red{5},{0}
|
||||
{17}@"really red"{5},{0}
|
||||
{5}};{0}
|
||||
{13}const{0} {10}color{5}:{0} {10}Color{0} {5}={0} {5}.{17}@"really red"{5};{0}
|
||||
|
Loading…
x
Reference in New Issue
Block a user