MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dont follow dark color for null

+20 -3
+1
include/highlight.h
··· 41 41 HL_REGEX_CDATA, 42 42 HL_BOOLEAN, 43 43 HL_NUMBER, 44 + HL_NUMBER_PREFIX, 44 45 HL_COMMENT, 45 46 HL_FUNCTION_NAME, 46 47 HL_CLASS_NAME,
+19 -3
src/highlight.c
··· 711 711 712 712 static const char *class_to_crvar(hl_token_class cls) { 713 713 switch (cls) { 714 - case HL_NUMBER: return "yellow"; 715 - case HL_BOOLEAN: return "magenta"; 716 - case HL_LITERAL_NULL: return "gray"; 714 + case HL_NUMBER: return "#E8CD7C"; 715 + case HL_NUMBER_PREFIX: return "#EADBAD"; 716 + case HL_BOOLEAN: return "#65B2FF"; 717 + case HL_LITERAL_NULL: return "#65B2FF"; 717 718 718 719 case HL_STRING: return "#FF8A7F"; 719 720 case HL_STRING_DELIMITER: return "#FF7265"; ··· 854 855 ob_write_with_class(o, in_class ? HL_REGEX_CDATA : HL_REGEX, s + seg_start, n - seg_start); 855 856 } 856 857 858 + static void ob_write_number_literal(outbuf_t *o, const char *s, size_t n) { 859 + if (n >= 2 && s[0] == '0' && 860 + (s[1] == 'x' || s[1] == 'X' || 861 + s[1] == 'b' || s[1] == 'B' || 862 + s[1] == 'o' || s[1] == 'O')) { 863 + ob_write_with_class(o, HL_NUMBER_PREFIX, s, 2); 864 + ob_write_with_class(o, HL_NUMBER, s + 2, n - 2); 865 + return; 866 + } 867 + 868 + ob_write_with_class(o, HL_NUMBER, s, n); 869 + } 870 + 857 871 int ant_highlight_stateful( 858 872 const char *input, size_t input_len, 859 873 char *out, size_t out_size, ··· 872 886 if (span_is_template_string(piece, span.len)) body_cls = HL_STRING_TEMPLATE; 873 887 ob_write_string_literal(&o, piece, span.len, body_cls); 874 888 } else if (span.cls == HL_REGEX) ob_write_regex_literal(&o, input + span.off, span.len); 889 + else if (span.cls == HL_NUMBER) ob_write_number_literal(&o, input + span.off, span.len); 875 890 else ob_write_with_class(&o, span.cls, input + span.off, span.len); 876 891 } 877 892 ··· 926 941 if (span_is_template_string(piece, emit_len)) body_cls = HL_STRING_TEMPLATE; 927 942 ob_write_string_literal(&o, piece, emit_len, body_cls); 928 943 } else if (span.cls == HL_REGEX) ob_write_regex_literal(&o, line + span.off, emit_len); 944 + else if (span.cls == HL_NUMBER) ob_write_number_literal(&o, line + span.off, emit_len); 929 945 else ob_write_with_class(&o, span.cls, line + span.off, emit_len); 930 946 } 931 947