Add single-quoted strings

This commit is contained in:
Nigel Tao committed 2020-03-25 19:41:02 +11:00
1 parent 3bfed6d812
commit 9e50918718
14 files changed
+273 -84

No files matched your search

+12 -1
View File
@@ -81,7 +81,8 @@ func (x ID) IsNumLiteral(m *Map) bool {
return false
}
func (x ID) IsStrLiteral(m *Map) bool {
// IsDQStrLiteral returns whether x is a double-quote string literal.
func (x ID) IsDQStrLiteral(m *Map) bool {
if x < nBuiltInIDs {
return false
} else if s := m.ByID(x); s != "" {
@@ -90,6 +91,16 @@ func (x ID) IsStrLiteral(m *Map) bool {
return false
}
// IsSQStrLiteral returns whether x is a single-quote string literal.
func (x ID) IsSQStrLiteral(m *Map) bool {
if x < nBuiltInIDs {
return false
} else if s := m.ByID(x); s != "" {
return s[0] == '\''
}
return false
}
func (x ID) IsIdent(m *Map) bool {
if x < nBuiltInIDs {
return minBuiltInIdent <= x && x <= maxBuiltInIdent