3 * Description: Standard ML programming language
.
4 * Author: Matthew Fluet <mfluet@acm
.org>
9 comment_face
--- comments
10 function_name_face
---
12 keyword_face
--- keywords
14 string_face
--- strings
16 variable_name_face
---
22 abstype and andalso as case do datatype else
23 end exception fn fun handle if in infix
24 infixr let local nonfix of op open orelse
25 raise rec then type val with withtype while
27 eqtype functor include sharing sig
28 signature struct structure where)) ;'
30 /\b(a
(bstype|nd
(|also
)|s
)|case|d
(atatype|o
)|e
(lse
|nd|qtype|xception
)|f
(n|un
(|ctor
))|handle|i
(f|n
(|clude|fix
(|r
)))|l
(et|ocal
)|nonfix|o
(f|p
(|en
)|relse
)|r
(aise|ec
)|s
(haring|ig
(|nature
)|truct
(|ure
))|t
(hen|ype
)|val|w
(h
(ere|ile
)|ith
(|type
)))\b/;
51 * Special constants
(strings
)
61 * Special constants
(chars
)
93 call
(sml_string_gap
);
132 sml_comment_depth
= 1;
136 sml_comment_depth
+= 1;
141 sml_comment_depth
-= 1;
143 if
(sml_comment_depth
== 0)
161 * Description: Standard ML programming language
.
162 * Author: Matthew Fluet <mfluet@acm
.org>
167 comment_face
--- comments
168 function_name_face
---
170 keyword_face
--- keywords
171 reference_face
--- special constants
(nums
)
172 string_face
--- strings
174 variable_name_face
---
178 require_state
(sml_simple
);
182 formatting
= [\
\t\n\011\012\013]+;
184 sml_formatting_str
= "[ \\t\\n\\011\\012\\013]+";
185 sml_formatting_re
= regexp
(sml_formatting_str
);
189 sml_letter_str
= "[A-Za-z]";
190 sml_letter_re
= regexp
(sml_letter_str
);
192 symbol
= [-!%&
$#+/:<=>?@
\\~`|
*^];
194 sml_symbol_str
= "[-!%&$#+/:<=>?@\\\\~`|*^]";
195 sml_symbol_re
= regexp
(sml_symbol_str
);
199 sml_digit_str
= "[0-9]";
200 sml_digit_re
= regexp
(sml_digit_str
);
202 hexdigit
= [0-9a
-fA
-F];
204 sml_hexdigit_str
= "[0-9a-fA-F]";
205 sml_hexdigit_re
= regexp
(sml_hexdigit_str
);
208 posdecint
= {digit
}+;
210 sml_posdecint_str
= sprintf
("(%s)+",sml_digit_str
);
211 sml_posdecint_re
= regexp
(sml_posdecint_str
);
213 poshexint
= "0x"{hexdigit
}+;
215 sml_poshexint_str
= sprintf
("0x(%s)+",sml_hexdigit_str
);
216 sml_poshexint_re
= regexp
(sml_poshexint_str
);
218 negdecint
= "~"{posdecint
};
220 sml_negdecint_str
= sprintf
("~(%s)",sml_posdecint_str
);
221 sml_negdecint_re
= regexp
(sml_negdecint_str
);
223 neghexint
= "~"{poshexint
};
225 sml_neghexint_str
= sprintf
("~(%s)",sml_poshexint_str
);
226 sml_neghexint_re
= regexp
(sml_neghexint_str
);
228 decint
= {posdecint
} |
{negdecint
};
230 sml_decint_str
= sprintf
("(%s)|(%s)",sml_posdecint_str,sml_negdecint_str
);
231 sml_decint_re
= regexp
(sml_decint_str
);
233 hexint
= {poshexint
} |
{neghexint
};
235 sml_hexint_str
= sprintf
("(%s)|(%s)",sml_poshexint_str,sml_negdecint_str
);
236 sml_hexint_re
= regexp
(sml_hexint_str
);
238 decword
= "0w"{digit
}+;
240 sml_decword_str
= sprintf
("0w(%s)+",sml_digit_str
);
241 sml_decword_re
= regexp
(sml_decword_str
);
243 hexword
= "0wx"{hexdigit
}+;
245 sml_hexword_str
= sprintf
("0wx(%s)+",sml_hexdigit_str
);
246 sml_hexword_re
= regexp
(sml_hexword_str
);
252 sml_exp_re
= regexp
(sml_exp_str
);
254 real
= ({decint
}"."{digit
}+ ({exp
}{decint
})?
) |
({decint
}{exp
}{decint
});
256 sml_real_str
= sprintf
("((%s)\\.(%s)+((%s)(%s))?)|((%s)(%s)(%s))",
257 sml_decint_str,sml_digit_str,sml_exp_str,sml_decint_str,
258 sml_decint_str,sml_exp_str,sml_decint_str
);
259 sml_real_re
= regexp
(sml_real_str
);
262 scon_num
= {decint
} |
{hexint
} |
{decword
} |
{hexword
} |
{real
}
264 sml_scon_num_str
= sprintf
("\\b((%s)|(%s)|(%s)|(%s)|(%s))\\b",
265 sml_decint_str,sml_hexint_str,
266 sml_decword_str,sml_hexword_str,
268 sml_scon_num_re
= regexp
(sml_scon_num_str
);
271 numericlab
= [1-9]{digit
}*;
273 sml_numericlab_str
= sprintf
("[1-9](%s)*",sml_digit_str
);
274 sml_numericlab_re
= regexp
(sml_numericlab_str
);
276 alphanumid
= {letter
}({letter
} |
{digit
} |
[_
'])*;
278 sml_alphanumid_str = sprintf("(%s)((%s)|(%s)|[_'])*",
279 sml_letter_str,sml_letter_str,sml_digit_str);
281 symbolicid = {symbol}+;
283 sml_symbolicid_str = sprintf("(%s
)+",sml_symbol_str);
284 sml_symbolicid_re = regexp(sml_symbolicid_str);
286 id = {alphanumid} | {symbolicid};
288 sml_id_str = sprintf("(%s
)|
(%s
)",sml_alphanumid_str,sml_symbolicid_str);
289 sml_id_re = regexp(sml_id_str);
291 tyvar = "'"({letter} | {digit} | [_'])*;
293 sml_tyvar_str
= sprintf
("'((%s)|(%s)|[_'])*",sml_letter_str,sml_digit_str
);
294 sml_tyvar_re
= regexp
(sml_tyvar_str
);
296 longid
= ({alphanumid
}".")+ {id
};
298 sml_longid_str
= sprintf
("((%s)\\.)+(%s)",sml_alphanumid_str,sml_id_str
);
299 sml_longid_re
= regexp
(sml_longid_str
);
302 lab
= {id
} |
{numericlab
}
304 sml_lab_str
= sprintf
("(%s)|(%s)",sml_id_str,sml_numericlab_str
);
305 sml_lab_re
= regexp
(sml_lab_str
);
307 sel
= "#" {formatting
} {lab
}
309 sml_sel_str
= sprintf
("#(%s)(%s)",sml_formatting_str,sml_lab_str
);
310 sml_sel_re
= regexp
(sml_sel_str
);
312 infix
= "infix"("r")?
{formatting
} ({digit
})?
314 sml_infix_str
= sprintf
("(infix(r?))(%s)(%s)?",sml_formatting_str,sml_digit_str
);
315 sml_infix_re
= regexp
(sml_infix_str
);
318 val_with_tyvar
= "val" {formatting
} {tyvar
}
319 val_with_tyvarseq
= "val" {formatting
} "(" {formatting
} {tyvar
}
320 fun_with_tyvar
= "fun" {formatting
} {tyvar
}
321 fun_with_tyvarseq
= "fun" {formatting
} "(" {formatting
} {tyvar
}
323 sml_val_with_tyvar_str
= sprintf
("(val)(%s)(%s)",sml_formatting_str,sml_tyvar_str
);
324 sml_val_with_tyvar_re
= regexp
(sml_val_with_tyvar_str
);
325 sml_val_with_tyvarseq_str
= sprintf
("(val)(%s)(\\\()(%s)(%s)",sml_formatting_str,sml_formatting_str,sml_tyvar_str
);
326 sml_val_with_tyvarseq_re
= regexp
(sml_val_with_tyvarseq_str
);
327 sml_fun_with_tyvar_str
= sprintf
("(fun)(%s)(%s)",sml_formatting_str,sml_tyvar_str
);
328 sml_fun_with_tyvar_re
= regexp
(sml_fun_with_tyvar_str
);
329 sml_fun_with_tyvarseq_str
= sprintf
("(fun)(%s)(\\\()(%s)(%s)",sml_formatting_str,sml_formatting_str,sml_tyvar_str
);
330 sml_fun_with_tyvarseq_re
= regexp
(sml_fun_with_tyvarseq_str
);
333 state sml_verbose
/* extends sml_simple
*/
338 keyword_face
(false);
347 * Special constants
(nums
)
350 reference_face
(true);
352 reference_face
(false);
355 /* extend sml_simple
*/
369 keyword_face
(false);
373 * Special constants
(strings
)
383 * Special constants
(chars
)
400 comment_face
(false);
440 * Description: Standard ML programming language
.
441 * Author: Matthew Fluet <mfluet@acm
.org>
446 comment_face
--- comments
447 function_name_face
--- modules keywords
449 keyword_face
--- core keywords
450 reference_face
--- special constants
(nums
)
451 string_face
--- strings
452 type_face
--- type bindings
453 variable_name_face
--- constructor bindings
457 require_state
(sml_verbose
);
464 sml_typctxt_expected_eqs
= -1;
465 SML_DATBIND_UNKNOWN = 1;
466 SML_DATBIND_REPL = 2;
467 SML_DATBIND_DECL = 3;
480 SML_AND_WHERETYPE = 8;
481 sml_andbind
= list
(SML_AND_NUL);
484 SML_MODULES_LEVEL = 1;
486 sml_endmatch
= list
(SML_MODULES_LEVEL);
488 sml_last_keyword
= "";
489 sub sml_keyword
(s, lvl
) {
490 sml_last_keyword
= s
;
491 if
(lvl
== SML_CORE_LEVEL)
493 else if
(lvl
= SML_MODULES_LEVEL)
494 function_name_face
(true);
496 if
(lvl
== SML_CORE_LEVEL)
497 keyword_face
(false);
498 else if
(lvl
= SML_MODULES_LEVEL)
499 function_name_face
(false);
502 sml_scopes
= list
(list
("",
SML_MODULES_LEVEL));
504 sub sml_enter_scope
(s, lvl
) {
505 sml_andbind
= list
(SML_AND_NUL, sml_andbind
);
506 sml_endmatch
= list
(-1, sml_endmatch
);
507 sml_scopes
= list
(list
(s,lvl
), sml_scopes
);
511 sub sml_leave_scope
() {
513 sml_scopes
= sml_scopes
[1];
514 sml_endmatch
= sml_endmatch
[1];
515 sml_andbind
= sml_andbind
[1];
518 sub sml_let_level
() {
519 local scopes
= sml_scopes
;
520 if
(sml_andbind
[0] == SML_AND_STRBIND ||
521 sml_andbind
[0] == SML_AND_FUNBIND) {
524 if
((strcmp
(scopes
[0][0],
"let") == 0 ||
525 strcmp
(scopes
[0][0],
"(") == 0) &&
526 scopes
[0][1] == SML_MODULES_LEVEL)
530 sub sml_local_level
() {
531 local scopes
= sml_scopes
;
533 if
((strcmp
(scopes
[0][0],
"let") == 0 ||
534 strcmp
(scopes
[0][0],
"(") == 0) &&
535 scopes
[0][1] == SML_MODULES_LEVEL)
537 while
(length
(scopes
) == 2) {
538 if
(strcmp
(scopes
[0][0],
"local") == 0 &&
539 scopes
[0][1] == SML_MODULES_LEVEL)
541 else if
(strcmp
(scopes
[0][0],
"let") == 0 &&
542 scopes
[0][1] == SML_MODULES_LEVEL)
550 sub sml_start_typctxt
(eqs
) {
552 sml_typctxt
= sml_scope
;
553 sml_typctxt_expected_eqs
= eqs
;
556 sub sml_start_typbind
() {
557 sml_start_typctxt
(1);
562 sub sml_start_eqtyp
() {
563 sml_start_typctxt
(0);
568 sub sml_start_wheretyp
() {
569 sml_start_typctxt
(1);
574 sub sml_start_sharingtyp
() {
575 sml_start_typctxt
(-1);
580 sub sml_start_datbind
() {
581 sml_start_typctxt
(1);
582 sml_datbind
= SML_DATBIND_UNKNOWN;
586 sub sml_start_exbind
() {
587 sml_start_typctxt
(1);
592 sub sml_finish_typctxt
() {
593 if
(sml_typctxt
== sml_scope
) {
595 sml_typctxt_expected_eqs
= -1;
596 if
(sml_datbind
) {sml_datbind
= FALSE; sml_conbind
= FALSE;}
597 if
(sml_exbind
) {sml_exbind
= FALSE; sml_conbind
= FALSE;}
604 state sml_fancy
/* extends sml_verbose
*/
613 sml_enter_scope
($0,sml_scopes
[0][1]);
617 sml_finish_typctxt
();
622 sml_finish_typctxt
();
623 sml_andbind
[0] = SML_AND_NUL;
627 if
(sml_datbind
== SML_DATBIND_DECL) {
637 if
(sml_typctxt
!= -1) {
641 if
(sml_typctxt_expected_eqs
== 0) {
642 sml_finish_typctxt
();
644 sml_typctxt_expected_eqs
--;
645 if
(sml_datbind
== SML_DATBIND_UNKNOWN) {
660 sml_finish_typctxt
();
661 sml_enter_scope
($0,
SML_CORE_LEVEL);
662 sml_keyword
($0,
SML_CORE_LEVEL);
663 sml_andbind
[0] = SML_AND_DATBIND;
664 sml_endmatch
[0] = SML_CORE_LEVEL;
665 sml_start_datbind
();
668 sml_finish_typctxt
();
669 if
(sml_andbind
[0] == SML_AND_VALBIND) {
670 sml_keyword
($0,
SML_CORE_LEVEL);
671 } else if
(sml_andbind
[0] == SML_AND_TYPBIND) {
672 sml_keyword
($0,
SML_CORE_LEVEL);
673 sml_start_typbind
();
674 } else if
(sml_andbind
[0] == SML_AND_DATBIND) {
675 sml_keyword
($0,
SML_CORE_LEVEL);
676 sml_start_datbind
();
677 } else if
(sml_andbind
[0] == SML_AND_EXBIND) {
678 sml_keyword
($0,
SML_CORE_LEVEL);
680 } else if
(sml_andbind
[0] == SML_AND_STRBIND) {
681 sml_keyword
($0,
SML_MODULES_LEVEL);
682 } else if
(sml_andbind
[0] == SML_AND_SIGBIND) {
683 sml_keyword
($0,
SML_MODULES_LEVEL);
684 } else if
(sml_andbind
[0] == SML_AND_FUNBIND) {
685 sml_keyword
($0,
SML_MODULES_LEVEL);
686 } else if
(sml_andbind
[0] == SML_AND_WHERETYPE) {
687 sml_keyword
($0,
SML_MODULES_LEVEL);
688 sml_last_keyword
= "where";
693 sml_keyword
($0,
SML_CORE_LEVEL);
696 sml_keyword
($0,
SML_CORE_LEVEL);
699 sml_keyword
($0,
SML_CORE_LEVEL);
702 if
(sml_datbind
== SML_DATBIND_UNKNOWN) {
703 sml_datbind
= SML_DATBIND_REPL;
705 sml_keyword
($0,
SML_CORE_LEVEL);
707 sml_finish_typctxt
();
708 sml_keyword
($0,
SML_CORE_LEVEL);
709 sml_andbind
[0] = SML_AND_DATBIND;
710 sml_start_datbind
();
714 sml_keyword
($0,
SML_CORE_LEVEL);
717 sml_keyword
($0,
SML_CORE_LEVEL);
720 sml_finish_typctxt
();
721 sml_keyword
($0, sml_endmatch
[0]);
725 sml_finish_typctxt
();
726 sml_keyword
($0,
SML_CORE_LEVEL);
730 sml_finish_typctxt
();
731 sml_keyword
($0,
SML_CORE_LEVEL);
732 sml_andbind
[0] = SML_AND_EXBIND;
736 sml_keyword
($0,
SML_CORE_LEVEL);
738 sml_fun_with_tyvar_re
{
739 sml_finish_typctxt
();
740 sml_keyword
($1,
SML_CORE_LEVEL);
745 sml_andbind
[0] = SML_AND_VALBIND;
747 sml_fun_with_tyvarseq_re
{
748 sml_finish_typctxt
();
749 sml_keyword
($1,
SML_CORE_LEVEL);
757 sml_andbind
[0] = SML_AND_VALBIND;
760 sml_finish_typctxt
();
761 sml_keyword
($0,
SML_CORE_LEVEL);
762 sml_andbind
[0] = SML_AND_VALBIND;
765 sml_finish_typctxt
();
766 sml_keyword
($0,
SML_MODULES_LEVEL);
767 sml_andbind
[0] = SML_AND_FUNBIND;
770 sml_keyword
($0,
SML_CORE_LEVEL);
773 sml_keyword
($0,
SML_CORE_LEVEL);
776 sml_finish_typctxt
();
777 sml_andbind
[0] = SML_AND_NUL;
778 sml_keyword
($0, sml_endmatch
[0]);
781 sml_finish_typctxt
();
782 sml_keyword
($0,
SML_MODULES_LEVEL);
785 sml_finish_typctxt
();
786 sml_keyword
($1,
SML_CORE_LEVEL);
791 sml_finish_typctxt
();
792 if
(sml_let_level
()) {
793 sml_enter_scope
($0,
SML_MODULES_LEVEL);
794 sml_keyword
($0,
SML_MODULES_LEVEL);
795 sml_endmatch
[0] = SML_MODULES_LEVEL;
797 sml_enter_scope
($0,
SML_CORE_LEVEL);
798 sml_keyword
($0,
SML_CORE_LEVEL);
799 sml_endmatch
[0] = SML_CORE_LEVEL;
803 sml_finish_typctxt
();
804 if
(sml_local_level
()) {
805 sml_enter_scope
($0,
SML_MODULES_LEVEL);
806 sml_keyword
($0,
SML_MODULES_LEVEL);
807 sml_endmatch
[0] = SML_MODULES_LEVEL;
809 sml_enter_scope
($0,
SML_CORE_LEVEL);
810 sml_keyword
($0,
SML_CORE_LEVEL);
811 sml_endmatch
[0] = SML_CORE_LEVEL;
815 sml_finish_typctxt
();
816 sml_keyword
($0,
SML_CORE_LEVEL);
819 sml_keyword
($0,
SML_CORE_LEVEL);
822 sml_keyword
($0,
SML_CORE_LEVEL);
825 sml_finish_typctxt
();
826 sml_keyword
($0,
SML_MODULES_LEVEL);
829 sml_keyword
($0,
SML_CORE_LEVEL);
832 sml_keyword
($0,
SML_CORE_LEVEL);
835 sml_keyword
($0,
SML_CORE_LEVEL);
838 sml_finish_typctxt
();
839 sml_keyword
($0,
SML_MODULES_LEVEL);
842 sml_enter_scope
($0,
SML_CORE_LEVEL);
843 sml_keyword
($0,
SML_MODULES_LEVEL);
844 sml_endmatch
[0] = SML_MODULES_LEVEL;
847 sml_finish_typctxt
();
848 sml_keyword
($0,
SML_MODULES_LEVEL);
849 sml_andbind
[0] = SML_AND_SIGBIND;
852 sml_enter_scope
($0,
SML_CORE_LEVEL);
853 sml_keyword
($0,
SML_MODULES_LEVEL);
854 sml_endmatch
[0] = SML_MODULES_LEVEL;
857 sml_finish_typctxt
();
858 sml_keyword
($0,
SML_MODULES_LEVEL);
859 sml_andbind
[0] = SML_AND_STRBIND;
862 sml_keyword
($0,
SML_CORE_LEVEL);
865 if
(strcmp
(sml_last_keyword,
"where") == 0) {
866 sml_keyword
($0,
SML_MODULES_LEVEL);
867 sml_last_keyword
= "where type";
868 sml_andbind
[0] = SML_AND_WHERETYPE;
869 sml_start_wheretyp
();
870 } else if
(strcmp
(sml_last_keyword,
"sharing") == 0) {
871 sml_keyword
($0,
SML_MODULES_LEVEL);
872 sml_last_keyword
= "sharing type";
873 sml_andbind
[0] = SML_AND_NUL;
874 sml_start_sharingtyp
();
876 sml_finish_typctxt
();
877 sml_keyword
($0,
SML_CORE_LEVEL);
878 sml_andbind
[0] = SML_AND_TYPBIND;
879 sml_start_typbind
();
882 sml_val_with_tyvar_re
{
883 sml_finish_typctxt
();
884 sml_keyword
($1,
SML_CORE_LEVEL);
889 sml_andbind
[0] = SML_AND_VALBIND;
891 sml_val_with_tyvarseq_re
{
892 sml_finish_typctxt
();
893 sml_keyword
($1,
SML_CORE_LEVEL);
901 sml_andbind
[0] = SML_AND_VALBIND;
904 sml_finish_typctxt
();
905 sml_keyword
($0,
SML_CORE_LEVEL);
906 sml_andbind
[0] = SML_AND_VALBIND;
909 sml_keyword
($0,
SML_MODULES_LEVEL);
912 sml_keyword
($0,
SML_CORE_LEVEL);
915 sml_finish_typctxt
();
916 sml_keyword
($0,
SML_CORE_LEVEL);
919 sml_finish_typctxt
();
920 sml_keyword
($0,
SML_CORE_LEVEL);
921 sml_andbind
[0] = SML_AND_TYPBIND;
922 sml_start_typbind
();
927 variable_name_face
(true);
929 variable_name_face
(false);
936 if
(sml_datbind
== SML_DATBIND_UNKNOWN)
937 sml_datbind
= SML_DATBIND_DECL;
939 variable_name_face
(true);
941 variable_name_face
(false);
947 /* extends sml_verbose
*/
951 keyword_face
(false);
960 * Special constants
(nums
)
963 reference_face
(true);
965 reference_face
(false);
968 /* extend sml_simple
*/
973 sml_finish_typctxt
();
983 keyword_face
(false);
987 * Special constants
(strings
)
997 * Special constants
(chars
)
1000 language_print
($1);
1002 language_print
($2);
1004 string_face
(false);
1011 comment_face
(true);
1012 language_print
($0);
1014 comment_face
(false);
1018 language_print
($0);
1031 * Description: Standard ML programming language
.
1032 * Author: Matthew Fluet <mfluet@acm
.org>
1037 comment_face
--- comments
1038 function_name_face
--- modules keywords
1040 keyword_face
--- core keywords
1041 reference_face
--- special constants
(nums
)
1042 string_face
--- strings
1043 type_face
--- type bindings, type annotations
1044 variable_name_face
--- constructor bindings
1048 require_state
(sml_fancy
);
1051 state sml_gaudy
/* extends sml_fancy
*/
1057 sml_finish_typctxt
();
1058 language_print
($0);
1061 if
(sml_andbind
[0] == SML_AND_STRBIND ||
1062 sml_andbind
[0] == SML_AND_FUNBIND) {
1063 language_print
($0);
1065 language_print
($0);
1066 if
(sml_typctxt
== -1)
1067 sml_start_typctxt
(0);
1071 /* extends sml_fancy
*/
1076 language_print
($0);
1079 sml_enter_scope
($0,sml_scopes
[0][1]);
1080 language_print
($0);
1083 sml_finish_typctxt
();
1084 language_print
($0);
1088 sml_finish_typctxt
();
1089 sml_andbind
[0] = SML_AND_NUL;
1090 language_print
($0);
1093 if
(sml_datbind
== SML_DATBIND_DECL) {
1095 language_print
($0);
1099 language_print
($0);
1103 if
(sml_typctxt
!= -1) {
1105 language_print
($0);
1107 if
(sml_typctxt_expected_eqs
== 0) {
1108 sml_finish_typctxt
();
1110 sml_typctxt_expected_eqs
--;
1111 if
(sml_datbind
== SML_DATBIND_UNKNOWN) {
1119 language_print
($0);
1123 language_print
($0);
1126 sml_finish_typctxt
();
1127 sml_enter_scope
($0,
SML_CORE_LEVEL);
1128 sml_keyword
($0,
SML_CORE_LEVEL);
1129 sml_andbind
[0] = SML_AND_DATBIND;
1130 sml_endmatch
[0] = SML_CORE_LEVEL;
1131 sml_start_datbind
();
1134 sml_finish_typctxt
();
1135 if
(sml_andbind
[0] == SML_AND_VALBIND) {
1136 sml_keyword
($0,
SML_CORE_LEVEL);
1137 } else if
(sml_andbind
[0] == SML_AND_TYPBIND) {
1138 sml_keyword
($0,
SML_CORE_LEVEL);
1139 sml_start_typbind
();
1140 } else if
(sml_andbind
[0] == SML_AND_DATBIND) {
1141 sml_keyword
($0,
SML_CORE_LEVEL);
1142 sml_start_datbind
();
1143 } else if
(sml_andbind
[0] == SML_AND_EXBIND) {
1144 sml_keyword
($0,
SML_CORE_LEVEL);
1145 sml_start_exbind
();
1146 } else if
(sml_andbind
[0] == SML_AND_STRBIND) {
1147 sml_keyword
($0,
SML_MODULES_LEVEL);
1148 } else if
(sml_andbind
[0] == SML_AND_SIGBIND) {
1149 sml_keyword
($0,
SML_MODULES_LEVEL);
1150 } else if
(sml_andbind
[0] == SML_AND_FUNBIND) {
1151 sml_keyword
($0,
SML_MODULES_LEVEL);
1152 } else if
(sml_andbind
[0] == SML_AND_WHERETYPE) {
1153 sml_keyword
($0,
SML_MODULES_LEVEL);
1154 sml_last_keyword
= "where";
1159 sml_keyword
($0,
SML_CORE_LEVEL);
1162 sml_keyword
($0,
SML_CORE_LEVEL);
1165 sml_keyword
($0,
SML_CORE_LEVEL);
1168 if
(sml_datbind
== SML_DATBIND_UNKNOWN) {
1169 sml_datbind
= SML_DATBIND_REPL;
1170 sml_conbind
= FALSE;
1171 sml_keyword
($0,
SML_CORE_LEVEL);
1173 sml_finish_typctxt
();
1174 sml_keyword
($0,
SML_CORE_LEVEL);
1175 sml_andbind
[0] = SML_AND_DATBIND;
1176 sml_start_datbind
();
1180 sml_keyword
($0,
SML_CORE_LEVEL);
1183 sml_keyword
($0,
SML_CORE_LEVEL);
1186 sml_finish_typctxt
();
1187 sml_keyword
($0, sml_endmatch
[0]);
1191 sml_finish_typctxt
();
1192 sml_keyword
($0,
SML_CORE_LEVEL);
1196 sml_finish_typctxt
();
1197 sml_keyword
($0,
SML_CORE_LEVEL);
1198 sml_andbind
[0] = SML_AND_EXBIND;
1199 sml_start_exbind
();
1202 sml_keyword
($0,
SML_CORE_LEVEL);
1204 sml_fun_with_tyvar_re
{
1205 sml_finish_typctxt
();
1206 sml_keyword
($1,
SML_CORE_LEVEL);
1207 language_print
($2);
1209 language_print
($3);
1211 sml_andbind
[0] = SML_AND_VALBIND;
1213 sml_fun_with_tyvarseq_re
{
1214 sml_finish_typctxt
();
1215 sml_keyword
($1,
SML_CORE_LEVEL);
1216 language_print
($2);
1217 language_print
($3);
1218 language_print
($4);
1220 language_print
($5);
1222 call
(sml_tyvarseq
);
1223 sml_andbind
[0] = SML_AND_VALBIND;
1226 sml_finish_typctxt
();
1227 sml_keyword
($0,
SML_CORE_LEVEL);
1228 sml_andbind
[0] = SML_AND_VALBIND;
1231 sml_finish_typctxt
();
1232 sml_keyword
($0,
SML_MODULES_LEVEL);
1233 sml_andbind
[0] = SML_AND_FUNBIND;
1236 sml_keyword
($0,
SML_CORE_LEVEL);
1239 sml_keyword
($0,
SML_CORE_LEVEL);
1242 sml_finish_typctxt
();
1243 sml_andbind
[0] = SML_AND_NUL;
1244 sml_keyword
($0, sml_endmatch
[0]);
1247 sml_finish_typctxt
();
1248 sml_keyword
($0,
SML_MODULES_LEVEL);
1251 sml_finish_typctxt
();
1252 sml_keyword
($1,
SML_CORE_LEVEL);
1253 language_print
($3);
1254 language_print
($4);
1257 sml_finish_typctxt
();
1258 if
(sml_let_level
()) {
1259 sml_enter_scope
($0,
SML_MODULES_LEVEL);
1260 sml_keyword
($0,
SML_MODULES_LEVEL);
1261 sml_endmatch
[0] = SML_MODULES_LEVEL;
1263 sml_enter_scope
($0,
SML_CORE_LEVEL);
1264 sml_keyword
($0,
SML_CORE_LEVEL);
1265 sml_endmatch
[0] = SML_CORE_LEVEL;
1269 sml_finish_typctxt
();
1270 if
(sml_local_level
()) {
1271 sml_enter_scope
($0,
SML_MODULES_LEVEL);
1272 sml_keyword
($0,
SML_MODULES_LEVEL);
1273 sml_endmatch
[0] = SML_MODULES_LEVEL;
1275 sml_enter_scope
($0,
SML_CORE_LEVEL);
1276 sml_keyword
($0,
SML_CORE_LEVEL);
1277 sml_endmatch
[0] = SML_CORE_LEVEL;
1281 sml_finish_typctxt
();
1282 sml_keyword
($0,
SML_CORE_LEVEL);
1285 sml_keyword
($0,
SML_CORE_LEVEL);
1288 sml_keyword
($0,
SML_CORE_LEVEL);
1291 sml_finish_typctxt
();
1292 sml_keyword
($0,
SML_MODULES_LEVEL);
1295 sml_keyword
($0,
SML_CORE_LEVEL);
1298 sml_keyword
($0,
SML_CORE_LEVEL);
1301 sml_keyword
($0,
SML_CORE_LEVEL);
1304 sml_finish_typctxt
();
1305 sml_keyword
($0,
SML_MODULES_LEVEL);
1308 sml_enter_scope
($0,
SML_CORE_LEVEL);
1309 sml_keyword
($0,
SML_MODULES_LEVEL);
1310 sml_endmatch
[0] = SML_MODULES_LEVEL;
1313 sml_finish_typctxt
();
1314 sml_keyword
($0,
SML_MODULES_LEVEL);
1315 sml_andbind
[0] = SML_AND_SIGBIND;
1318 sml_enter_scope
($0,
SML_CORE_LEVEL);
1319 sml_keyword
($0,
SML_MODULES_LEVEL);
1320 sml_endmatch
[0] = SML_MODULES_LEVEL;
1323 sml_finish_typctxt
();
1324 sml_keyword
($0,
SML_MODULES_LEVEL);
1325 sml_andbind
[0] = SML_AND_STRBIND;
1328 sml_keyword
($0,
SML_CORE_LEVEL);
1331 if
(strcmp
(sml_last_keyword,
"where") == 0) {
1332 sml_keyword
($0,
SML_MODULES_LEVEL);
1333 sml_last_keyword
= "where type";
1334 sml_andbind
[0] = SML_AND_WHERETYPE;
1335 sml_start_wheretyp
();
1336 } else if
(strcmp
(sml_last_keyword,
"sharing") == 0) {
1337 sml_keyword
($0,
SML_MODULES_LEVEL);
1338 sml_last_keyword
= "sharing type";
1339 sml_andbind
[0] = SML_AND_NUL;
1340 sml_start_sharingtyp
();
1342 sml_finish_typctxt
();
1343 sml_keyword
($0,
SML_CORE_LEVEL);
1344 sml_andbind
[0] = SML_AND_TYPBIND;
1345 sml_start_typbind
();
1348 sml_val_with_tyvar_re
{
1349 sml_finish_typctxt
();
1350 sml_keyword
($1,
SML_CORE_LEVEL);
1351 language_print
($2);
1353 language_print
($3);
1355 sml_andbind
[0] = SML_AND_VALBIND;
1357 sml_val_with_tyvarseq_re
{
1358 sml_finish_typctxt
();
1359 sml_keyword
($1,
SML_CORE_LEVEL);
1360 language_print
($2);
1361 language_print
($3);
1362 language_print
($4);
1364 language_print
($5);
1366 call
(sml_tyvarseq
);
1367 sml_andbind
[0] = SML_AND_VALBIND;
1370 sml_finish_typctxt
();
1371 sml_keyword
($0,
SML_CORE_LEVEL);
1372 sml_andbind
[0] = SML_AND_VALBIND;
1375 sml_keyword
($0,
SML_MODULES_LEVEL);
1378 sml_keyword
($0,
SML_CORE_LEVEL);
1381 sml_finish_typctxt
();
1382 sml_keyword
($0,
SML_CORE_LEVEL);
1385 sml_finish_typctxt
();
1386 sml_keyword
($0,
SML_CORE_LEVEL);
1387 sml_andbind
[0] = SML_AND_TYPBIND;
1388 sml_start_typbind
();
1392 sml_conbind
= FALSE;
1393 variable_name_face
(true);
1394 language_print
($0);
1395 variable_name_face
(false);
1397 language_print
($0);
1402 if
(sml_datbind
== SML_DATBIND_UNKNOWN)
1403 sml_datbind
= SML_DATBIND_DECL;
1404 sml_conbind
= FALSE;
1405 variable_name_face
(true);
1406 language_print
($0);
1407 variable_name_face
(false);
1409 language_print
($0);
1413 /* extends sml_verbose
*/
1415 keyword_face
(true);
1416 language_print
($1);
1417 keyword_face
(false);
1418 language_print
($3);
1419 language_print
($4);
1422 language_print
($0);
1426 * Special constants
(nums
)
1429 reference_face
(true);
1430 language_print
($0);
1431 reference_face
(false);
1434 /* extend sml_simple
*/
1439 sml_finish_typctxt
();
1447 keyword_face
(true);
1448 language_print
($0);
1449 keyword_face
(false);
1453 * Special constants
(strings
)
1457 language_print
($0);
1459 string_face
(false);
1463 * Special constants
(chars
)
1466 language_print
($1);
1468 language_print
($2);
1470 string_face
(false);
1477 comment_face
(true);
1478 language_print
($0);
1480 comment_face
(false);
1484 language_print
($0);