--- /dev/null
+cat << EOC
+## Gwion config for GNU nano
+##
+
+syntax "gwion" "\.gw"
+
+formatter gwion-nano-fmt
+linter gwion -g check
+EOC
+
+scope=0
+while read -r line
+do
+# echo "$line"
+ comment="$(sed 's/ *#!.*//' <<< "$line")"
+ if [ "$comment" != "$line" ]
+ then continue
+ fi
+ if [ "$(grep operator <<< "$line")" ]
+ then continue
+ fi
+ primitive="$(sed 's/^ *primitive *\([a-zA-Z][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$primitive" != "$line" ]
+ then
+ echo "color bold,mauve \"\<${primitive}\>\""
+ continue
+ fi
+ class="$(sed 's/^ *class *\([a-zA-Z][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$class" != "$line" ]
+ then
+ echo "color mauve \"\<${class}\>\""
+ scope=$((scope+1))
+ continue
+ fi
+ struct="$(sed 's/^ *struct *\([a-zA-Z][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$struct" != "$line" ]
+ then
+ echo "color mauve \"\<${struct}\>\""
+ scope=$((scope+1))
+ continue
+ fi
+ enum="$(sed 's/^ *enum *\([a-zA-Z][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$enum" != "$line" ]
+ then
+ echo "color italic,mauve \"\<${enum}\>\""
+ scope=$((scope+1))
+ continue
+ fi
+ fun="$(sed 's/^ *fun *[a-zA-Z][a-zA-Z0-9_]* *\([a-zA-Z][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$fun" != "$line" ]
+ then
+ if [ $scope -eq 0 ]
+ then echo "color mint \"\<${fun}\>\""
+ else echo "color mint \".\<${fun}\>\""
+ fi
+ if [ "${line: -1}" != ";" ]
+ then scope=$((scope+1))
+ fi
+ continue
+ fi
+ funptr="$(sed 's/^ *funptr *[a-zA-Z][a-zA-Z0-9_]* *\([a-zA-Z][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$funptr" != "$line" ]
+ then
+ echo "color italic,mint \"\<${funptr}\>\""
+ continue
+ fi
+ typedef="$(sed 's/^ *typedef *[a-zA-Z][a-zA-Z0-9_]* *\([a-zA-Z][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$typedef" != "$line" ]
+ then
+ echo "color italic,mauve \"\<${typedef}\>\""
+ continue
+ fi
+ ignoreconstspid="$(sed 's/^ *specialid const *@\([a-zA-Z_][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$ignoreconstspid" != "$line" ]
+ then
+ continue
+ fi
+ ignorespid="$(sed 's/^ *specialid *@\([a-zA-Z_][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$ignorespid" != "$line" ]
+ then
+ continue
+ fi
+ constspid="$(sed 's/^ *specialid *const *\([a-zA-Z_][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$constspid" != "$line" ]
+ then
+ echo "color italic,lightyellow \"\<${constspid}\>\""
+ continue
+ fi
+ spid="$(sed 's/^ *specialid *\([a-zA-Z_][a-zA-Z0-9_]*\).*/\1/' <<< "$line")"
+ if [ "$spid" != "$line" ]
+ then
+ echo "color lightyellow \"\<${spid}\>\""
+ continue
+ fi
+ lbrace="$(sed 's/^ *{.*$/@smth/' <<< "$line")"
+ if [ "$lbrace" != "$line" ]
+ then
+ scope=$((scope+1))
+ continue
+ fi
+ rbrace="$(sed 's/^ *}.*$/@smth/' <<< "$line")"
+ if [ "$lbrace" != "$line" ]
+ then scope=$((scope-1))
+ continue
+ fi
+# misses items rn
+done < $1
+
+cat << EOC
+comment "#!"
+
+color italic,red start="#\<(pragma|include|define|ifdef|ifndef|undef|endif|require)\>" end="\$"
+
+color brightred "\<(typeof|spork|fork)\>"
+color lightred "\<(second|ms|day|samp|minute|hour)\>"
+color brightcyan "\<(maybe)\>"
+color cyan "\<(adc|blackhole)\>"
+
+color brightgreen "\<(try|handle|perform|retry|class|struct|trait|union|enum|fun|operator|funptr|typedef|distinct)\>"
+color italic,yellow "extends"
+color italic,brightgreen "\<(final|abstract)\>"
+color lightgreen "@[a-zA-Z]+[a-zA-Z0-9_]*|&[a-zA-Z]+[a-zA-Z0-9_]*"
+color green "\<(static|global)\>"
+color italic,green "\<(protected|private)\>"
+color bold,green "\<(var|late|const)\>"
+color bold,italic,green "\<(const)\>"
+
+color bold,yellow "\<(for|until|if|while|do|else|match|case|when|where|defer)\>"
+color magenta "\<(goto|continue|break|return)\>"
+
+## Comment highlighting
+color italic,lightblue start="#!" end="\$|!#"
+
+color white "\?|:|$||\+|\-||\*|/|%|~|^|&|!||^|@|=|<|>|\+"
+
+color pink "\<(\.[0-9]([0-9]*)|[0-9]+(\.)*)\>"
+
+#String highlighting. You will in general want your comments and
+## strings to come last, because syntax highlighting rules will be
+## applied in the order they are read in.
+#color brightyellow "(\\.|[^"])*""
+##
+## This string is VERY resource intensive!
+#color italic,brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
+color italic,brightyellow start="\"" end="\""
+color italic,lightyellow start="\`" end="\`"
+
+## Trailing whitespace
+color ,green "[[:space:]]+\$"
+EOC
+
const Exp when = cpy_exp(env->gwion->mp, tdef->when);
when->next = helper;
const Stmt stmt = new_stmt_exp(env->gwion->mp, ae_stmt_exp, when, when->pos);
-// const Stmt stmt_return = new_stmt_exp(env->gwion->mp, ae_stmt_return, new_prim_id(env->gwion->mp, insert_symbol("self"), when->pos), when->pos);
-// const Stmt_List ret_list = new_stmt_list(env->gwion->mp, stmt_return, NULL);//ret_list);
const Stmt_List body = new_stmt_list(env->gwion->mp, stmt, NULL);//ret_list);
const Stmt code = new_stmt_code(env->gwion->mp, body, when->pos);
const Func_Def fdef = new_func_def(env->gwion->mp, fb, code);
CHECK_BB(traverse_func_def(env, fdef));
const Exp predicate = stmt->d.stmt_exp.val;
if(isa(predicate->type, env->gwion->type[et_bool]) < 0) {
- char explain[strlen(predicate->type->name) + 7];
+ char explain[strlen(predicate->type->name) + 20];
sprintf(explain, "found `{/+}%s{0}`", predicate->type->name);
gwerr_basic("Invalid `{/+}when{0}` predicate expression type", explain, "use `{/+}bool{0}`",
env->name, when->pos, 0);