From 540c89ce44f013a1bcf89d03348523e7a90ff500 Mon Sep 17 00:00:00 2001 From: atf1206 Date: Tue, 23 Jun 2020 17:57:02 -0400 Subject: [PATCH] Fix underscore highlighting --- syntax/q.tmLanguage | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/syntax/q.tmLanguage b/syntax/q.tmLanguage index fd126c9..8ce5732 100644 --- a/syntax/q.tmLanguage +++ b/syntax/q.tmLanguage @@ -181,7 +181,7 @@ name other.assignment.q match - (?=([^a-zA-Z0-9]|\b))([a-zA-Z]+[a-zA-Z0-9_]*)\s*([,+\-*%@$!?<>=~|&\#]?)(::|:) + (?<=([^a-zA-Z0-9])|(?<=\b))([a-zA-Z]+[a-zA-Z0-9_]*)\s*([,+\-*%@$!?<>=~|&\#]?)(::|:) captures @@ -384,7 +384,7 @@ name constant.numeric.complex.q match - (?=(\W|\b))([-]?[0-9]+[bhijf]?(\.[0-9]+[m]?)?|0x[a-fA-F0-9]+)(?=(\W|\b)|_) + ((?<=(\W))|(?<=_)|(?<=\b))([-]?[0-9]+[bhijf]?(\.[0-9]+[m]?)?|0x[a-fA-F0-9]+)(?=(\W|\b)|_) @@ -394,7 +394,7 @@ name constant.numeric.complex.real.q match - (?=(\W|\b))([-]?[0-9]+e[-]?[0-9]+)(?=(\W|\b)) + ((?<=\W)|(?<=_)|(?<=\b))([-]?[0-9]+e[-]?[0-9]+)(?=(\W|\b)) @@ -404,7 +404,7 @@ name constant.numeric.complex.null.q match - (?=(\W|\b))(0n|0N[ghijepmdznuvt]?)(?=(\W|\b)) + ((?<=\W)|(?<=_)|(?<=\b))(0n|0N[ghijepmdznuvt]?)(?=(\W|\b)) @@ -414,7 +414,7 @@ name constant.numeric.complex.inf.q match - (?=(\W|\b))(0w|0W[hijepdznuvt]?)(?=(\W|\b)) + ((?<=\W)|(?<=_)|(?<=\b))(0w|0W[hijepdznuvt]?)(?=(\W|\b)) @@ -424,7 +424,7 @@ name support.function.q match - [!$@\\/_#?|',`\\:] + [!$@\\/#?|',`\\:] comment @@ -434,6 +434,22 @@ match \.(?=\W) + + comment + placeholder for variable names with underscores + name + source.q + match + [a-zA-Z][a-zA-Z0-9_]+ + + + comment + drop (underscore) + name + support.function.q + match + (?<=[0-9\s])_ +