File: test.ha.ref

package info (click to toggle)
kf6-syntax-highlighting 6.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 47,568 kB
  • sloc: xml: 197,750; cpp: 12,850; python: 3,023; sh: 955; perl: 546; ruby: 488; pascal: 393; javascript: 161; php: 150; jsp: 132; lisp: 131; haskell: 124; ada: 119; ansic: 107; makefile: 96; f90: 94; ml: 85; cobol: 81; yacc: 71; csh: 62; erlang: 54; sql: 51; java: 47; objc: 37; awk: 31; asm: 30; tcl: 29; fortran: 18; cs: 10
file content (35 lines) | stat: -rw-r--r-- 4,500 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<Comment>// This is from Hare tutorials:</Comment><br/>
<Comment>// https://harelang.org/tutorials/introduction/</Comment><br/>
<Normal Text></Normal Text><br/>
<Use>use</Use><Normal Text> bufio</Normal Text><Operator>;</Operator><br/>
<Use>use</Use><Normal Text> fmt</Normal Text><Operator>;</Operator><br/>
<Use>use</Use><Normal Text> os</Normal Text><Operator>;</Operator><br/>
<Use>use</Use><Normal Text> strings</Normal Text><Operator>;</Operator><br/>
<Normal Text></Normal Text><br/>
<Keyword>export</Keyword><Normal Text> </Normal Text><Keyword>fn</Keyword><Function> main() void = {</Function><br/>
<Normal Text>    </Normal Text><Built In>let</Built In><Normal Text> x</Normal Text><Operator>:</Operator><Normal Text> </Normal Text><Data Type>str</Data Type><Normal Text> </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>"\0 \x234 \uaaaaa \Ufffffffff"</String><Operator>;</Operator><br/>
<Normal Text>    </Normal Text><Built In>let</Built In><Normal Text> z</Normal Text><Operator>:</Operator><Normal Text> char </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>'a'</String><Operator>;</Operator><br/>
<Normal Text>    </Normal Text><Built In>let</Built In><Normal Text> y</Normal Text><Operator>:</Operator><Normal Text> char </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><String>'\0'</String><Operator>;</Operator><br/>
<Normal Text></Normal Text><br/>
<Normal Text>    </Normal Text><Built In>let</Built In><Normal Text> n </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Decimal>7e7i8</Decimal><Operator>;</Operator><br/>
<Normal Text>    </Normal Text><Built In>let</Built In><Normal Text> f </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Decimal>8</Decimal><Operator>.</Operator><Decimal>6</Decimal><Operator>;</Operator><br/>
<Normal Text>    </Normal Text><Built In>let</Built In><Normal Text> f2 </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Decimal>8</Decimal><Operator>.</Operator><Float>6f64</Float><Operator>;</Operator><br/>
<Normal Text>    </Normal Text><Built In>let</Built In><Normal Text> bin </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><BaseN>0x1231234f32</BaseN><Operator>;</Operator><br/>
<Normal Text>    </Normal Text><Built In>let</Built In><Normal Text> asd </Normal Text><Operator>=</Operator><Normal Text> \</Normal Text><Decimal>01234553</Decimal><Operator>;</Operator><br/>
<Normal Text></Normal Text><br/>
<Normal Text>    </Normal Text><Built In>let</Built In><Normal Text> b </Normal Text><Operator>=</Operator><Normal Text> </Normal Text><Keyword>true</Keyword><Operator>;</Operator><br/>
<Normal Text>	</Normal Text><Built In>const</Built In><Normal Text> user </Normal Text><Operator>=</Operator><Normal Text> askname</Normal Text><Operator>();</Operator><br/>
<Normal Text>	greet</Normal Text><Operator>(</Operator><Normal Text>user</Normal Text><Operator>);</Operator><br/>
<Operator>};</Operator><br/>
<Normal Text></Normal Text><br/>
<Comment>// Asks the user to provide their name.</Comment><br/>
<Keyword>fn</Keyword><Function> askname() str = {</Function><br/>
<Normal Text>	fmt</Normal Text><Operator>::</Operator><Normal Text>println</Normal Text><Operator>(</Operator><String>"Hello! Please enter your name:"</String><Operator>)!;</Operator><br/>
<Normal Text>	</Normal Text><Built In>const</Built In><Normal Text> name </Normal Text><Operator>=</Operator><Normal Text> bufio</Normal Text><Operator>::</Operator><Normal Text>scanline</Normal Text><Operator>(</Operator><Normal Text>os</Normal Text><Operator>::</Operator><Normal Text>stdin</Normal Text><Operator>)!</Operator><Normal Text> </Normal Text><Keyword>as</Keyword><Normal Text> </Normal Text><Operator>[]</Operator><Data Type>u8</Data Type><Operator>;</Operator><br/>
<Normal Text>	</Normal Text><Control Flow>return</Control Flow><Normal Text> strings</Normal Text><Operator>::</Operator><Normal Text>fromutf8</Normal Text><Operator>(</Operator><Normal Text>name</Normal Text><Operator>)!;</Operator><br/>
<Operator>};</Operator><br/>
<Normal Text></Normal Text><br/>
<Comment>// Greets a user by name.</Comment><br/>
<Keyword>fn</Keyword><Function> greet(user: str) void = {</Function><br/>
<Normal Text>	fmt</Normal Text><Operator>::</Operator><Normal Text>printfln</Normal Text><Operator>(</Operator><String>"Hello, {}!"</String><Operator>,</Operator><Normal Text> user</Normal Text><Operator>)!;</Operator><br/>
<Operator>};</Operator><br/>