KeywordsTest

Euphoria4 Keywords and routines built in to ex, exw, exwc and exu

  --posted w/o quotes to test eucode colorizing in euwiki and forum 
  -- note: a few discrepencies from the official include/euphoria/keywords.e 
  -- typos peek3u, peek_sting  and missing peeks, profile_time 
  -- namespace probably has to be added to euphoria tokenizer 
 
 
public constant keywords = { 
          and, 
          as, 
          break, 
          by, 
          case, 
          constant, 
          continue, 
          do, 
          else, 
          elsedef, 
          elsif, 
          elsifdef, 
          end, 
          entry, 
          enum, 
          exit, 
          export, 
          for, 
          function, 
          global, 
          goto, 
          if, 
          ifdef, 
          include, 
          label, 
          loop, 
          namespace, 
          not, 
          or, 
          override, 
          procedure, 
          public, 
          retry, 
          return, 
          switch, 
          then, 
          to, 
          type, 
          until, 
          while, 
          with, 
          without, 
          xor 
  } 
  
public constant builtins = { 
          -- !, #,    $,    &,    :,  
 ?, 
          abort, 
          and_bits, 
          append, 
          arctan, 
          atom, 
          c_func, 
          c_proc, 
          call, 
          call_func, 
          call_proc, 
          clear_screen, 
          close, 
          command_line, 
          compare, 
          cos, 
          date, 
          equal, 
          find, 
          find_from, 
          floor, 
          get_key, 
          get_pixel, 
          getc, 
          getenv, 
          gets, 
          hash, 
          head, 
          include_paths, 
          insert, 
          integer, 
          length, 
          log, 
          machine_func, 
          machine_proc, 
          match, 
          match_from, 
          mem_copy, 
          mem_set, 
          not_bits, 
          object, 
          open, 
          option_switches, 
          or_bits, 
          peek, 
          peeks, 
          peek_string, 
          peek2s, 
          peek2u, 
          peek4s, 
          peek4u, 
          pixel, 
          platform, 
          poke, 
          poke2, 
          poke4, 
          position, 
          power, 
          prepend, 
          print, 
          printf, 
          profile, 
          profile_time, 
          puts, 
          rand, 
          remainder, 
          remove, 
          repeat, 
          replace, 
          routine_id, 
          sequence, 
          sin, 
          splice, 
          sprintf, 
          sqrt, 
          system, 
          system_exec, 
          tan, 
          tail, 
          task_clock_start, 
          task_clock_stop, 
          task_create, 
          task_list, 
          task_schedule, 
          task_self, 
          task_status, 
          task_suspend, 
          task_yield, 
          time, 
          trace, 
          warning, 
          xor_bits 
  } 
/* multiline comment 
start of a euphoria4 indent and syntax test file 
includes all keywords and builtins 
should have examples of correct syntax of all operators 
eui -TEST may show some warnings but no errors 
this test file serves no function other than to use all words 
why aren't strings colorized? 
 
*/ 
 
--use all keywords 
 
with  inline   
without trace 
 
include std\types.e -- 
 
include std\map.e as M 
 
 
include std/sequence.e 
include "std/sequence.e" 
 
namespace syntax 
 
global constant g=1 
export enum  ONE, TWO, THREE, FOUR  
 
 
--indent test should decompress these depending on options 
public type w(object o) return 1 end type 
 
override procedure puts(integer channel,sequence text)  
    eu:puts(log_file, text)  
    eu:puts(channel, text)  
end procedure  
 
 
function f1() return 1 end function 
procedure p1() end procedure 
 
 
routine  --is reserved for future but a syntax error now? 
 
-- WIN32 OSX UNIX LINUX SAFE TEST UNITTEST 
ifdef WIN32 then 
elsifdef UNIX then 
elsedef 
end ifdef 
 
 
	 
	if xor not 1 and 1 or  0 then  
	elsif 1 then  
	end if 
	 
	for x= 1 to 10 by 2 do 
	    if x=1 then continue 
		else	    retry 
	    end if 
	    goto "outside" 
	    break  
	end for 
 
label "outside" 
	 
	switch(1) do  
	    case 1 then  
		 
	    case else  
		fallthru 
	end switch 
 
	     
	loop do  
 
	until 1 
	     
	while 1 with entry with label "inside" do  
	    exit 
	    entry print "entry" 
	    exit "inside" 
	end while 
 
--use all builtins 
with profile(0) 
without profile_time --can't use both profile & profile_time 
	trace(0) 
atom a 
integer i 
object o 
sequence s = "x" & "y" 
 
     
    ? length(s) 
	print "\t\n\\\r" 
	printf(1, #! 
______multiline string test! ,{}) 
	s = sprintf("%s", {s}) 
     
 /*multiline line /**/*/ 
 /*multiline line */ 
      
 	warning("warning"/*multiline */)   
 	warning("warning" /*multiline */) 
 	warning("warning" )/*multiline */ 
 	warning("warning" ) /*multiline */ 
 	warning("warning" )--oneliner"not a string" 
 	warning(""warning"" )--oneliner empty string 
 	warning(''warning`` )--oneliner empty sq bq 
 	warning("warning""warning" )--crowd 2 strings\\ 
 	warning(`warning``warning` )--crowd 2 strings 
 	warning(\`warning`..`warning\\` ,,) 
 
 	-- \t-- euphoria colorizer distinguishes 5 bracket levels 
 s = x[[[[1], 2], 3]] 
 s = x[[[[[1], 2], 3]]] 
 s = open(x[[[[[{1}], 2], 3]]]) 
 s = open(x[[[[[{1}],open( 2, x[1],    )], 3]]]) 
 s = open(x[[[ 
    [[{1}],open(  
    2, x[1],    )], 3] 
  ]]) 
 
 atom Ucode =  U"1 2 34 56 
                78AbC" 
 
	-- 
	clear_screen 
	get_pixel 
	pixel 
	position 
	 
	s = command_line() 
	option_switches() 
	s = include_paths() 
	platform() 
	system() 
	system_exec() 
	getenv() 
	get_key() 
 
	getc() 
	gets() 
	puts() 
 
 
	delete() 
	delete_routine() 
	 
	compare() 
	equal() 
	 
	date 
	time 
 
	repeat() 
	append() 
	prepend() 
	insert() 
	remove() 
	head() 
	tail() 
	replace() 
	splice() 
	 
	find() 
	match() 
	find_from() 
	match_from() 
	 
	arctan(0) 
	cos(0) 
	floor(0) 
	log(0) 
	sin(0) 
	sqrt(0) 
 	tan(0) 
	rand() 
	remainder() 
	power() 
	hash() 
	 
	and_bits() 
	not_bits() 
	or_bits() 
	xor_bits() 
	 
	machine_func() 
	machine_proc() 
	routine_id() 
	c_func() 
	c_proc() 
	call() 
	call_func() 
	call_proc() 
 
 
	mem_copy() 
	mem_set() 
	peek() 
	peek2s() 
	peek2u() 
	peek4s() 
	peek4u() 
	peek_string() 
	peeks() 
	poke() 
	poke2() 
	poke4() 
	 
	integer f = open("x", "r") 
	/* can I close f if x doesn't exist? */ 
	if f>2 then close(f) end if 
	 
	 
	task_clock_start() 
	task_clock_stop() 
	task_create() 
	task_list() 
	task_schedule() 
	task_self() 
	task_status() 
	task_suspend() 
	task_yield() 
	 
atom A = 1-2+3/4*5 
 A += 0 --does this get optomized out? 
abort(0) 
 
 

shouldn't this last line be delete? creole on last line is ignored?
end line no lineending,

Search



Quick Links

User menu

Not signed in.

Misc Menu