STUDIO HAZE · image
Topaz source
Open by house policy. Topaz is our own language.
Topaz 5.21 · 113 files
topaz/src/names/java.tpz
Topaz · 1984 B · Original file
1
// Java reserved words and identifier-ignorable code points for anonymous names.3
import util { 문자열배열에있음 }5
export function 자바예약이름(이름: string) -> bool {6
문자열배열에있음([7
"abstract", "assert", "boolean", "break", "byte", "case", "catch",8
"char", "class", "const", "continue", "default", "do", "double",9
"else", "enum", "exports", "extends", "false", "final", "finally",10
"float", "for", "goto", "if", "implements", "import", "instanceof",11
"int", "interface", "long", "module", "native", "new", "non-sealed",12
"null", "open", "opens", "package", "permits", "private", "protected",13
"provides", "public", "record", "requires", "return", "sealed", "short",14
"static", "strictfp", "super", "switch", "synchronized", "this", "throw",15
"throws", "to", "transient", "true", "try", "uses", "var", "void",16
"volatile", "when", "while", "with", "yield", "_"17
], 이름)18
}20
function 자바식별자무시코드(코드: int) -> bool {21
(코드 >= 0 && 코드 <= 8) || (코드 >= 14 && 코드 <= 27) ||22
(코드 >= 127 && 코드 <= 159) || 코드 == 173 ||23
(코드 >= 1536 && 코드 <= 1541) || 코드 == 1564 || 코드 == 1757 ||24
코드 == 1807 || 코드 == 2274 || 코드 == 6158 ||25
(코드 >= 8203 && 코드 <= 8207) || (코드 >= 8234 && 코드 <= 8238) ||26
(코드 >= 8288 && 코드 <= 8292) || (코드 >= 8294 && 코드 <= 8303) ||27
코드 == 65279 || (코드 >= 65529 && 코드 <= 65531) ||28
코드 == 69821 || 코드 == 69837 ||29
(코드 >= 78896 && 코드 <= 78904) ||30
(코드 >= 113824 && 코드 <= 113827) ||31
(코드 >= 119155 && 코드 <= 119162) || 코드 == 917505 ||32
(코드 >= 917536 && 코드 <= 917631)33
}35
export function 자바정규식별자(이름: string) -> string {36
let mut 결과 = ""37
for 글자 in 이름.scalars() {38
let 코드 = 글자.codePointAt(0) ?? 039
if !자바식별자무시코드(코드) { 결과 = 결과 + 글자 }40
}41
결과42
}SHA256 95adc31b8e2310a5d473eab478b15dc2cd6ef908184a99f29004216babf31a93