]> gitweb.factorcode.org Git - factor.git/blob - misc/fuel/strange-syntax.factor
5c52c48ea9b302a2e8890146d874eed2bb0f1edd
[factor.git] / misc / fuel / strange-syntax.factor
1 USING: accessors alien.c-types alien.syntax
2 classes.struct colors.constants colors.hex kernel literals logging
3 math ;
4 IN: strange
5
6 ! FUEL Syntax Demo
7 !
8 ! The purpose of this file is to test that corner cases are
9 ! highlighted correctly by FUEL. So if you change something in the
10 ! syntax highlighting and it breaks, things will be badly hightlighted
11 ! here.
12 USING: alien.syntax kernel math ;
13 IN: strange-syntax
14
15 TUPLE: a-tuple slot1 slot2 { slot3 integer } { slot4 initial: "hi" } ;
16   TUPLE: second-one ;
17
18     USING: tools.test ;
19
20 TUPLE: initial-array { slot2 initial: { 123 } } slot3 ;
21
22 ! ! Strings
23 "containing \"escapes" drop
24
25 ! ! Symbol names
26
27 TUPLE: tup
28     ko
29     get\it
30     { eh\ integer }
31     { oh'ho } ;
32
33 ! All slashes are symbol constituents.
34 : hack/slash ( t -- x ) ko>> ;
35
36 : um ( x y -- ) get\it<< ;
37
38 : slash\hack ( m -- y )
39     get\it>> dup >>get\it ;
40
41 : very-weird[33] ( -- ) ;
42
43 LOG: what NOTICE
44
45 TUPLE: oh\no { and/again initial: "meh" } ;
46
47 ! As are quotes
48 : don't-do-that ( x -- y ) ;
49
50 ! Double quotes aren't right yet.
51 ! : do-"that" ( x -- y ) ;
52
53 ! ! C-TYPE
54 C-TYPE: cairo_snurface_t
55
56 ! ! CHAR
57 : stuff-with-chars ( -- K \n )
58     CHAR: K
59     CHAR: \n
60     CHAR: \"        ! <- \" should be highlighted
61     drop ;
62
63 ! ! MAIN
64 : majn ( -- ) ;
65
66 MAIN: majn
67
68 ! ! SLOT
69  SLOT: komba
70
71 ! ! SYNTAX
72 <<
73 SYNTAX: ID-SYNTAX ;
74 >>
75
76 ID-SYNTAX ID-SYNTAX
77
78 ! ! Numbers
79 { -55 -0x10 100,00 1,000,000 0x2000,0000 0b01 } drop
80
81 ! ! Containers
82 V{ 1 2 3 } drop
83 HS{ 9 8 3 } drop
84
85 flags{ 10 20 } drop
86
87 ! ! Alien functions
88 STRUCT: timeval
89     { sec long }
90     { usec long } ;
91
92 FUNCTION: int futimes ( int id,
93                         timeval[2] times,
94                         int x,
95                         int y )
96 FUNCTION: int booyah ( int x )
97 FUNCTION-ALIAS: test int bah ( int* ah, int[] eh )
98
99 HEXCOLOR: ffffff COLOR: green NAN: 1234 CHAR: m ALIEN: 93
100 2drop 2drop drop
101
102 PRIMITIVE: one ( a -- b )
103 PRIMITIVE: two ( c -- d )