]> gitweb.factorcode.org Git - factor.git/blob - misc/fuel/strange-syntax.factor
add extra:syntax.terse, for bitwise ops. Addresses #2641.
[factor.git] / misc / fuel / strange-syntax.factor
1 USING: accessors alien.c-types alien.syntax classes.struct
2 colors kernel literals logging math ;
3 IN: strange
4
5 ! FUEL Syntax Demo
6 !
7 ! The purpose of this file is to test that corner cases are
8 ! highlighted correctly by FUEL. So if you change something in the
9 ! syntax highlighting and it breaks, things will be badly hightlighted
10 ! here.
11 USING: alien.syntax kernel math ;
12 IN: strange-syntax
13
14 TUPLE: a-tuple slot1 slot2 { slot3 integer } { slot4 initial: "hi" } ;
15   TUPLE: second-one ;
16
17     USING: tools.test ;
18
19 TUPLE: initial-array { slot2 initial: { 123 } } slot3 ;
20
21 ! ! Strings
22 "containing \"escapes" drop
23
24 ! ! Symbol names
25
26 TUPLE: tup
27     ko
28     get\it
29     { eh\ integer }
30     { oh'ho } ;
31
32 ! All slashes are symbol constituents.
33 : hack/slash ( t -- x ) ko>> ;
34
35 : um ( x y -- ) get\it<< ;
36
37 : slash\hack ( m -- y )
38     get\it>> dup >>get\it ;
39
40 : very-weird[33] ( -- ) ;
41
42 LOG: what NOTICE
43
44 TUPLE: oh\no { and/again initial: "meh" } ;
45
46 ! As are quotes
47 : don't-do-that ( x -- y ) ;
48
49 ! Double quotes aren't right yet.
50 ! : do-"that" ( x -- y ) ;
51
52 ! ! C-TYPE
53 C-TYPE: cairo_snurface_t
54
55 ! ! CHAR
56 : stuff-with-chars ( -- K \n )
57     CHAR: K
58     CHAR: \n
59     CHAR: \"        ! <- \" should be highlighted
60     drop ;
61
62 ! ! MAIN
63 : majn ( -- ) ;
64
65 MAIN: majn
66
67 ! ! SLOT
68  SLOT: komba
69
70 ! ! SYNTAX
71 <<
72 SYNTAX: ID-SYNTAX ;
73 >>
74
75 ID-SYNTAX ID-SYNTAX
76
77 ! ! Numbers
78 { -55 -0x10 100,00 1,000,000 0x2000,0000 0b01 } drop
79 { -0x100_000 100_00 1_000_000 0x2000_0000 0b0_1 } 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 COLOR: #ffffff COLOR: green NAN: 1234 CHAR: m ALIEN: 93
100 2drop 2drop drop
101
102 PRIMITIVE: one ( a -- b )
103 PRIMITIVE: two ( c -- d )
104
105 : `word ( -- ) ;
106 : word ( -- ) ; ! this isn't strange, just for contrast with the above