Last active
July 31, 2023 15:48
-
-
Save zeffii/40e54bdb1eaa9e0bc377f03726c5bfe9 to your computer and use it in GitHub Desktop.
syntax hilighting for pixilang ( incomplete )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML 1.2 | |
--- | |
# See http://www.sublimetext.com/docs/3/syntax.html | |
name: Pixilang | |
file_extensions: | |
- pixi | |
scope: source.pixi | |
variables: | |
gl_constants_re: |- | |
(?x: | |
GL_POINTS | GL_LINE_STRIP | GL_LINE_LOOP | GL_LINES | GL_TRIANGLE_STRIP | |
| GL_TRIANGLE_FAN | GL_TRIANGLES | GL_ZERO | GL_ONE | GL_SRC_COLOR | GL_ONE_MINUS_SRC_COLOR | |
| GL_DST_COLOR | GL_ONE_MINUS_DST_COLOR | GL_SRC_ALPHA | GL_ONE_MINUS_SRC_ALPHA | |
| GL_DST_ALPHA | GL_ONE_MINUS_DST_ALPHA | GL_SRC_ALPHA_SATURATE | GL_BFB_IDENTITY_MATRIX | |
| GL_MAX_TEXTURE_SIZE | GL_MAX_VERTEX_ATTRIBS | GL_MAX_VERTEX_UNIFORM_VECTORS | |
| GL_MAX_VARYING_VECTORS | GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS | GL_MAX_TEXTURE_IMAGE_UNITS | |
| GL_MAX_FRAGMENT_UNIFORM_VECTORS | GL_SHADER_SOLID | GL_SHADER_GRAD | |
| GL_SHADER_TEX_ALPHA_SOLID | GL_SHADER_TEX_ALPHA_GRAD | GL_SHADER_TEX_RGB_SOLID | |
| GL_SHADER_TEX_RGB_GRAD | GL_SCREEN | GL_ZBUF | |
)\b | |
events_re: |- | |
(?x: | |
EVT | EVT_TYPE | EVT_FLAGS | EVT_TIME | EVT_X | EVT_Y | EVT_KEY | EVT_SCANCODE | |
| EVT_PRESSURE | EVT_MOUSEBUTTONDOWN | EVT_MOUSEBUTTONUP | EVT_MOUSEMOVE | |
| EVT_TOUCHBEGIN | EVT_TOUCHEND | EVT_TOUCHMOVE | EVT_BUTTONDOWN | EVT_BUTTONUP | |
| EVT_SCREENRESIZE | EVT_FLAG_SHIFT | EVT_FLAG_CTRL | |
| EVT_FLAG_ALT | EVT_FLAG_MODE | EVT_FLAG_MODS | EVT_FLAG_DOUBLECLICK | |
| KEY_MOUSE_LEFT | KEY_MOUSE_MIDDLE | KEY_MOUSE_RIGHT | KEY_MOUSE_SCROLLUP | KEY_MOUSE_SCROLLDOWN | |
| KEY_BACKSPACE | KEY_TAB | KEY_ENTER | KEY_ESCAPE | KEY_SPACE | |
| KEY_F1 | KEY_F2 | KEY_F3 | KEY_F4 | KEY_F5 | KEY_F6 | KEY_F7 | KEY_F8 | KEY_F9 | KEY_F10 | KEY_F11 | KEY_F12 | |
| KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT | |
| KEY_INSERT | KEY_DELETE | KEY_HOME | KEY_END | KEY_PAGEUP | KEY_PAGEDOWN | KEY_CAPS | |
| KEY_SHIFT | KEY_CTRL | KEY_ALT | KEY_MENU | KEY_UNKNOWN | |
)\b | |
contexts: | |
# The prototype context is prepended to all contexts but those setting | |
# meta_include_prototype: false. | |
prototype: | |
- include: comments | |
main: | |
# The main context is the initial starting point of our syntax. | |
# Include other contexts from here (or specify them directly). | |
- include: keywords | |
- include: numbers | |
- include: strings | |
- include: variable_names | |
- include: operators | |
- include: pixilang_color | |
- include: builtin_functions | |
- include: functions | |
- include: constants | |
- include: simple_constants | |
- include: gl_constants | |
- include: event_constants | |
- include: go_form_coda | |
- include: go_form | |
- include: multiline_comments | |
multiline_comments: | |
- match: '/\*[\s\S]*?\*/' | |
scope: punctuation.definition.comment.pixi | |
go_form: | |
- match: '\w+:' | |
scope: entity.name.function.pixi | |
go_form_coda: | |
- match: '(go) (\w+)\b' | |
captures: | |
1: keyword.control.pixi | |
2: entity.name.function.pixi | |
functions: | |
- match: '(fn) \b(\w+)\b' | |
captures: | |
1: storage.type.function.pixi | |
2: entity.name.function.pixi | |
gl_constants: | |
- match: '{{gl_constants_re}}\b' | |
scope: constant.language.pixi | |
simple_constants: | |
- match: '\b(TOP|BOTTOM|LEFT|RIGHT|ORANGE|BLACK|WHITE|YELLOW|RED|GREEN|BLUE)\b' | |
scope: constant.language.pixi | |
event_constants: | |
- match: '{{events_re}}\b' | |
scope: constant.language.pixi | |
builtin_functions: | |
- match: |- | |
(?x: | |
clean|new|remove|remove_with_alpha|resize|rotate|convert_type | |
|clone|copy|get_size|get_xsize|get_ysize|get_esize|get_type|get_flags|set_flags|reset_flags | |
|get_prop|set_prop|remove_prop|remove_props|get_proplist|remove_proplist|show_memory_debug_messages | |
|zlib_pack|zlib_unpack|num_to_str|str_to_num|strcat|strcmp|strlen|strstr|sprintf|sprintf2|printf|fprintf | |
|logf|get_log|get_system_log | |
# file loading? | |
|load|fload|save|fsave|get_real_path|new_flist|remove_flist|get_flist_name|get_flist_type | |
|flist_next|get_file_size|get_file_format|get_fformat_mime|get_fformat_ext|remove_file | |
|rename_file|copy_file|create_directory|set_disk0|get_disk0|fopen|fopen_mem|fclose|fputc | |
|fputs|fwrite|fgetc|fgets|fread|feof|fflush|fseek|ftell|setxattr|frame|vsync | |
|set_pixel_size|get_pixel_size|set_screen|get_screen|set_zbuf|get_zbuf|clear_zbuf | |
|get_color|get_red|get_green|get_blue|get_blend|transp|get_transp|clear|dot|dot3d | |
|get_dot|get_dot3d|line|line3d|box|fbox|pixi|triangles3d|sort_triangles3d | |
|set_key_color|get_key_color|set_alpha|get_alpha|print|get_text_xsize | |
|get_text_ysize|get_text_xysize|set_font|get_font|effector | |
|color_gradient|split_rgb|split_ycbcr | |
# | |
|sin|cos|rand|mod|div | |
# gl | |
|set_gl_callback|remove_gl_data|update_gl_data | |
|gl_draw_arrays|gl_blend_func|gl_bind_framebuffer|gl_bind_texture|gl_get_int|gl_get_float | |
|gl_new_prog|gl_use_prog|gl_uniform|gl_uniform_matrix | |
# animation | |
|pack_frame|unpack_frame|create_anim|remove_anim|clone_frame|remove_frame|play|stop | |
|t_reset|t_rotate|t_translate|t_scale|t_push_matrix|t_pop_matrixt_get_matrix|t_set_matrix | |
|t_mul_matrix|t_point|set_audio_callback|get_audio_sample_rate|enable_audio_input|get_note_freq | |
|midi_open_client|midi_close_client|midi_get_device|midi_open_port | |
|midi_reopen_port|midi_close_port|midi_get_event|midi_get_event_time | |
|midi_next_event|midi_send_event|start_timer|get_timer | |
|get_year|get_month|get_day|get_hours|get_minutes|get_seconds | |
|get_ticks|get_tps|sleep|get_event|set_quit_action|thread_create | |
|thread_destroy|mutex_create | |
|mutex_destroy|mutex_lock | |
|mutex_trylock|mutex_unlock | |
|reinterpret_type|op_cn | |
|op_cc|op_ccn|generator|wavetable_generator | |
|sampler|envelope2p|gradient|fft|new_filter|remove_filter|reset_filter | |
|init_filter|apply_filter | |
|replace_values|copy_and_resize | |
|conv_filter|file_dialog | |
|prefs_dialog|textinput_dialog | |
|open_url|dlopen|dlclose|dlsym|dlcall|system|argc|argv|exit)\b | |
scope: support.function.builtin.pixi | |
constants: | |
- match: |- | |
(?x: | |
INT | INT8 | INT16 | INT32 | INT64 | FLOAT | FLOAT32 | FLOAT64 | PIXEL | |
| CFLAG_INTERP | GL_MIN_LINEAR | GL_MAG_LINEAR | GL_NICEST | |
| GL_NO_XREPEAT | GL_NO_YREPEAT | GL_NO_ALPHA|GL_NPOT | |
| RESIZE_INTERP1 | RESIZE_INTERP2 | RESIZE_UNSIGNED_INTERP2 | |
| RESIZE_COLOR_INTERP1 | RESIZE_COLOR_INTERP2 | |
| COPY_NO_AUTOROTATE | COPY_CLIPPING | |
# archives | |
| Z_NO_COMPRESSION | Z_BEST_SPEED | Z_BEST_COMPRESSION | Z_DEFAULT_COMPRESSION | |
| FORMAT_RAW | FORMAT_WAVE | FORMAT_AIFF | FORMAT_OGG | FORMAT_MP3 | FORMAT_FLAC | |
| FORMAT_MIDI | FORMAT_SUNVOX | FORMAT_SUNVOXMODULE | FORMAT_XM | FORMAT_MOD | |
| FORMAT_JPEG | FORMAT_PNG | FORMAT_GIF | FORMAT_AVI | FORMAT_MP4 | FORMAT_ZIP | |
| FORMAT_PIXICONTAINER | |
| LOAD_FIRST_FRAME | GIF_GRAYSCALE | GIF_DITHER | JPEG_H1V1 | JPEG_H2V1 | JPEG_H2V2 | JPEG_TWOPASS | |
# pxl effects? | |
| EFF_NOISE | EFF_SPREAD_LEFT | EFF_SPREAD_RIGHT | EFF_SPREAD_UP | EFF_SPREAD_DOWN | |
| EFF_HBLUR | EFF_VBLUR | EFF_COLOR | AUDIO_FLAG_INTERP2 | |
# midi | |
| MIDI_PORT_READ | MIDI_PORT_WRITE | |
# ? | |
| QA_NONE | QA_CLOSE_VM | |
| THREAD_FLAG_AUTO_DESTROY | M_E | M_LOG2E | M_LOG10E | M_LN2 | M_LN10 | M_PI | |
| M_2_SQRTPI | M_SQRT2 | M_SQRT1_2 | |
# operands | |
| OP_MIN | OP_MAX | OP_MAXABS | OP_SUM | OP_LIMIT_TOP | OP_LIMIT_BOTTOM | OP_ABS | OP_SUB2 | |
| OP_COLOR_SUB2 | OP_DIV2 | OP_H_INTEGRAL | OP_V_INTEGRAL | OP_H_DERIVATIVE | OP_V_DERIVATIVE | |
| OP_H_FLIP | OP_V_FLIP | |
| OP_ADD | OP_SADD | OP_COLOR_ADD | OP_SUB | OP_SSUB | OP_COLOR_SUB | OP_MUL | OP_SMUL | |
| OP_MUL_RSHIFT15 | OP_COLOR_MUL | OP_DIV | OP_COLOR_DIV | OP_AND | OP_OR | OP_XOR | |
| OP_LSHIFT | OP_RSHIFT | OP_EQUAL | OP_LESS | OP_GREATER | |
| OP_COPY | OP_COPY_LESS | OP_COPY_GREATER | |
| OP_BMUL | OP_EXCHANGE | OP_COMPARE | OP_MUL_DIV | OP_MUL_RSHIFT | |
| OP_SIN | OP_SIN8 | OP_RAND | |
# sample states | |
| SMP_INFO_SIZE | SMP_DEST | SMP_DEST_OFF | SMP_DEST_LEN | SMP_SRC | SMP_SRC_OFF_H | |
| SMP_SRC_OFF_L | SMP_SRC_SIZE | SMP_LOOP | SMP_LOOP_LEN | SMP_VOL1 | SMP_VOL2 | SMP_DELTA | |
| SMP_FLAGS | SMP_FLAG_INTERP2 | SMP_FLAG_INTERP4 | SMP_FLAG_PINGPONG | SMP_FLAG_REVERSE | |
# filters | |
| CONV_FILTER_COLOR | CONV_FILTER_BORDER_EXTEND | CONV_FILTER_BORDER_SKIP | CONV_FILTER_UNSIGNED | |
| FDIALOG_FLAG_LOAD | CCONV_DEFAULT | CCONV_CDECL | CCONV_STDCALL | CCONV_UNIX_AMD64 | |
| CCONV_WIN64 | POSIX | FOPEN_MAX | SEEK_CUR | SEEK_END | SEEK_SET | EOF | |
| STDIN | STDOUT | STDERR | |
# pixilang info | |
| PIXINFO_MULTITOUCH | PIXINFO_TOUCHCONTROL | PIXINFO_NOWINDOW | PIXINFO_MIDIIN | PIXINFO_MIDIOUT | |
| PIXILANG_VERSION | |
# os info | |
| OS_NAME | ARCH_NAME | LANG_NAME | CURRENT_PATH | USER_PATH | TEMP_PATH | |
# opengl | |
| OPENGL | INT_SIZE | FLOAT_SIZE | INT_MAX | COLORBITS | |
| WINDOW_XSIZE | WINDOW_YSIZE | WINDOW_ZSIZE | |
| WINDOW_SAFE_AREA_X | WINDOW_SAFE_AREA_Y | |
| WINDOW_SAFE_AREA_W | WINDOW_SAFE_AREA_H | |
| FPS | PPI | UI_SCALE | UI_FONT_SCALE | PIXILANG_INFO | EVT_QUIT)\b | |
scope: constant.language.pixi | |
keywords: | |
# Keywords are if, else for and while. | |
# Note that blackslashes don't need to be escaped within single quoted | |
# strings in YAML. When using single quoted strings, only single quotes | |
# need to be escaped: this is done by using two single quotes next to each | |
# other. | |
- match: '\b(if|else|for|while|include|continue|break|ret|halt|breakall)\b' | |
scope: keyword.control.pixi | |
numbers: | |
- match: '\b(-)?[0-9.]+\b' | |
scope: constant.numeric.pixi | |
operators: | |
- match: '=|/|<<|>>|<|>|-|\!|\^|\+|\!=|\*' | |
scope: keyword.operator.pixi | |
strings: | |
# Strings begin and end with quotes, and use backslashes as an escape | |
# character. | |
- match: '"' | |
scope: punctuation.definition.string.begin.pixi | |
push: inside_string | |
inside_string: | |
- meta_include_prototype: false | |
- meta_scope: string.quoted.double.pixi | |
- match: '\.' | |
scope: constant.character.escape.pixi | |
- match: '"' | |
scope: punctuation.definition.string.end.pixi | |
pop: true | |
variable_names: | |
- match: '\$\w+\b' | |
scope: variable.parameter.pixi | |
comments: | |
# Comments begin with a '//' and finish at the end of the line. | |
- match: '//' | |
scope: punctuation.definition.comment.pixi | |
push: | |
# This is an anonymous context push for brevity. | |
- meta_scope: comment.line.double-slash.pixi | |
- match: $\n? | |
pop: true | |
pixilang_color: | |
- match: '#[ABCDEF01234567]{6}\b' | |
scope: constant.numeric.pixilang | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"cmd": ["D:/DOWNLOADS/2023/pixilang-3.8.3b/pixilang/pixilang3/bin/windows_x86_64/pixilang.exe", "$file"], | |
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", | |
"selector": "source.pixi", | |
"shell": true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment