1,2c1,3
< # KEHOME/src/XMLtoken.icn
< # Jan/3/2003
---
> # KEHOME/src/token.icn
> # Feb/23/2003
> # new syntax -- semicolon ends sentence
62c63
< local matchline,continueline
---
> local matchline,mapline
76,79c77,78
< continueline := ""
< case KFORMAT of {
< default: {
<     matchline ? {
---
> mapline := ""
> matchline ? {
130c129
< 		continueline ||:= word.wvalue
---
> 		mapline ||:= word.wvalue
132,190c131
<     } # end line ?
<     } # end default
< ("html"|"htm"|"xml"|"rdf"): {
<     matchline ? {
< 	while word := (
< 		#WORD("h",m_html()) 		|  # single-line only
< 		WORD("Q",m_dquote())		|
< 		WORD("q",m_squote())		|
< 		#WORD("c",m_comment())		|
< 		WORD("b",m_whitespace())	|
< 		WORD("s",m_separator())		|
< 		WORD("=",m_assignword())	|
< 		WORD("w",m_word())
< 		) #####& tab(0)
< 	do  {
< 		# phase 1: map wtype for get_token() 
< 		case word.wtype of {
< 		"h": {
< 		    if DEBUG==("HTML"|"XML"|"RDF") then {
< 			writes_type(mybug,word,info||"html: word")
< 			writes_type(mylog,word,info||"html: word")
< 		    } # end if DEBUG
< 		    } # end "h"
< 		("q"|"Q"): {
< 		    val := word.wvalue
< 		    if *val = 1 then {
< 			if DEBUG=="QUOTE" then {
< 			  writes_type(mybug,val,warning||"isolated quote mark")
< 			  writes_type(mylog,val,warning||"isolated quote mark")
< 			}
< 			word.wtype := "w"
< 		    } # end if *val
< 		    } # end "q"|"Q"
< 		"c": { }
< 		"b": { word.wtype := "B" }
< 		"s": {
< 		    # other separators
< 		    # <> [,] {;} () !
< 		    word.wtype := SpecialWord[word.wvalue]
< 		    }
< 		"=": { }
< 		"w": {
< 		    # recognize end & exit
< 		    case word.wvalue of {
< 		    "end":  { word.wtype := SpecialWord[word.wvalue] }
< 		    "exit": { word.wtype := SpecialWord[word.wvalue] }
< 		    }
< 		    word.wvalue := map_word(word.wvalue)  # token.icn
< 		    # don't substitute yet
< 		    #if member(SpecialWord,word.wvalue) then
< 		    #	word.wtype := SpecialWord[word.wvalue]
< 		    }
< 		} # end case word.wtype
< 		put(wordlist,word)
< 		continueline ||:= word.wvalue
< 	} # end do
<     } # end line ?
<     } # end "html"|...
< } # end case KFORMAT
---
> } # end line ?
196,201c137,142
< if continueline==line then { } else {
< if DEBUG=="MAP" then {
<   writes_type(mybug,continueline,warning||"map_word: continueline")
<   writes_type(mylog,continueline,warning||"map_word: continueline")
< } # end if DEBUG
< } # end if continueline
---
> if mapline==line then { } else {
>   if DEBUG=="MAP" then {
>     writes_type(mybug,mapline,warning||"map_word: mapline")
>     writes_type(mylog,mapline,warning||"map_word: mapline")
>   } # end if DEBUG
> } # end if mapline
213,216c154,162
<   junk := dc2mkr("init")
<   junk := rdf2mkr("init")
<   junk := owl2mkr("init")
<   junk := mcf2mkr("init")
---
>   junk := dc2mkr("dc:title")
>   junk := rdf2mkr("rdfs:Class")
>   junk := owl2mkr("owl:Thing")
>   junk := mcf2mkr("Node")
> }
> case KMAPWORD of {
> default:       { return word }
> ("NO"|"no"):   { return word }
> ("YES"|"yes"): { }
554a501
> 	'<>'	++	# HTML command			(S)
557,558c504
< 	#'()'	++	# precedence			(S)
< 	'<>'		# HTML command			(S)
---
> 	'()'	 	# precedence			(S)
596,598c542,544
< 	#insert(SpecialWord,"+","+")  # assignment,word
< 	#insert(SpecialWord,"-","-")  # assignment,word
< 	#insert(SpecialWord,"*","*")  # assignment,word, wildcard
---
> 	insert(SpecialWord,"+","+")  # assignment,word
> 	insert(SpecialWord,"-","-")  # assignment,word
> 	insert(SpecialWord,"*","*")  # assignment,word, wildcard
600,604c546,550
< 	#insert(SpecialWord,"*","*")  # assignment,wildcard
< 	#insert(SpecialWord,"!","!")  # assignment,sh command
< 	#insert(SpecialWord,"&","&")  # assignment,and
< 	#insert(SpecialWord,"|","|")  # assignment,or
< 	#insert(SpecialWord,"~","~")  # assignment,not
---
> 	insert(SpecialWord,"*","*")  # assignment,wildcard
> 	insert(SpecialWord,"!","!")  # assignment,sh command
> 	insert(SpecialWord,"&","&")  # assignment,and
> 	insert(SpecialWord,"|","|")  # assignment,or
> 	insert(SpecialWord,"~","~")  # assignment,not
610,612c556,558
< 	insert(SpecialWord,"\'","q")  # squote for get_word()
< 	insert(SpecialWord,"\"","Q")  # dquote for get_word()
< 	insert(SpecialWord,"#","c")   # comment for get_word()
---
> 	#insert(SpecialWord,"\'","q")  # squote for get_word()
> 	#insert(SpecialWord,"\"","Q")  # dquote for get_word()
> 	#insert(SpecialWord,"#","c")   # comment for get_word()
622,623c568,569
< 	#insert(SpecialWord,"(","S")  # precedence
< 	#insert(SpecialWord,")","S")  # precedence
---
> 	insert(SpecialWord,"(","S")  # precedence
> 	insert(SpecialWord,")","S")  # precedence
644,646d589
< 	#####insert(SpecialWord,"Description","D")
< 	#####insert(SpecialWord,"/Description","d")
< 	#####insert(SpecialWord,"about","A")
648,651c591,594
< 	#insert(SpecialWord,"at","A")		# strong reserved
< 	#insert(SpecialWord,"space","s")
< 	#insert(SpecialWord,"time","t")
< 	#insert(SpecialWord,"view","v")
---
> 	insert(SpecialWord,"at","A")		# strong reserved
> 	insert(SpecialWord,"space","s")
> 	insert(SpecialWord,"time","t")
> 	insert(SpecialWord,"view","v")
655,656c598,599
< 	#insert(SpecialWord,"concept","g")
< 	#insert(SpecialWord,"LATTICE","g")
---
> 	insert(SpecialWord,"concept","g")
> 	insert(SpecialWord,"LATTICE","g")
660,661c603,604
< 	#insert(SpecialWord,"directory","g")
< 	#insert(SpecialWord,"list","g")
---
> 	insert(SpecialWord,"directory","g")
> 	insert(SpecialWord,"list","g")
663,664c606,607
< 	#insert(SpecialWord,"multiset","g")
< 	#insert(SpecialWord,"sequence","g")
---
> 	insert(SpecialWord,"multiset","g")
> 	insert(SpecialWord,"sequence","g")
677c620
< 	#insert(SpecialWord,"vdo","D")		# all views
---
> 	insert(SpecialWord,"vdo","D")		# all views
681c624
< 	insert(SpecialWord,"at","P")		# context ==> use "A"
---
> 	#insert(SpecialWord,"at","P")		# context ==> use "A"
684c627
< 	#insert(SpecialWord,"out","P")		# product
---
> 	insert(SpecialWord,"out","P")		# product
690,691c633,634
< 	#insert(SpecialWord,"vset","S")		# all views
< 	#insert(SpecialWord,"unset","S")		# unset variable
---
> 	insert(SpecialWord,"vset","S")		# all views
> 	insert(SpecialWord,"unset","S")		# unset variable
697c640
< 	#insert(SpecialWord,"isin","H")
---
> 	insert(SpecialWord,"isin","H")
701,703c644,646
< 	#insert(SpecialWord,"isa**","l")		# followed by word
< 	#insert(SpecialWord,"isa**?","?")	# question verb
< 	#insert(SpecialWord,"isa+","R")		# 1 or more levels
---
> 	insert(SpecialWord,"isa**","l")		# followed by word
> 	insert(SpecialWord,"isa**?","?")	# question verb
> 	insert(SpecialWord,"isa+","R")		# 1 or more levels
706,708c649,651
< 	#insert(SpecialWord,"isc**","l")		# followed by word
< 	#insert(SpecialWord,"isc**?","?")	# question verb
< 	#insert(SpecialWord,"isc+","R")		# 1 or more levels
---
> 	insert(SpecialWord,"isc**","l")		# followed by word
> 	insert(SpecialWord,"isc**?","?")	# question verb
> 	insert(SpecialWord,"isc+","R")		# 1 or more levels
717,718c660,661
< 	#insert(SpecialWord,"isu*","R")		# unit isu* primitive
< 	#insert(SpecialWord,"isp*","R")		# primitive isp* unit
---
> 	insert(SpecialWord,"isu*","R")		# unit isu* primitive
> 	insert(SpecialWord,"isp*","R")		# primitive isp* unit
720c663
< 	#insert(SpecialWord,"in","R")		# x in concept list
---
> 	insert(SpecialWord,"in","R")		# x in concept list
724c667
< 	#insert(SpecialWord,"isapart","p")	# partlist isapart entity
---
> 	insert(SpecialWord,"isapart","p")	# partlist isapart entity
727c670
< 	#insert(SpecialWord,"isalt","R")		# alternative isalt exgroup
---
> 	insert(SpecialWord,"isalt","R")		# alternative isalt exgroup
729,730c672,673
< 	#insert(SpecialWord,"isalt*","R")	# alternative isalt* exgroup
< 	#insert(SpecialWord,"isany*","R")	# exgroup isany* alternative
---
> 	insert(SpecialWord,"isalt*","R")	# alternative isalt* exgroup
> 	insert(SpecialWord,"isany*","R")	# exgroup isany* alternative
734,735c677,678
< 	#insert(SpecialWord,"isall*","R")	# ingroup isall* member
< 	#insert(SpecialWord,"ismem*","R")	# member ismem* ingroup
---
> 	insert(SpecialWord,"isall*","R")	# ingroup isall* member
> 	insert(SpecialWord,"ismem*","R")	# member ismem* ingroup
738,739c681,682
< 	#insert(SpecialWord,"isd","i")		# differentiate -- also command
< 	#insert(SpecialWord,"isi","i")		# integrate -- also command
---
> 	insert(SpecialWord,"isd","i")		# differentiate -- also command
> 	insert(SpecialWord,"isi","i")		# integrate -- also command
747,754c690,697
< 	#insert(SpecialWord,"if","I")		# conditional
< 	#insert(SpecialWord,"iff","J")
< 	#insert(SpecialWord,"then","T")		# conditional
< 	#insert(SpecialWord,"else","E")		# conditional
< 	#insert(SpecialWord,"fi","F")		# conditional
< 	#insert(SpecialWord,"every","W")		# iteration
< 	#insert(SpecialWord,"while","W")		# iteration
< 	#insert(SpecialWord,"when","W")		# monitor events
---
> 	insert(SpecialWord,"if","I")		# conditional
> 	insert(SpecialWord,"iff","J")
> 	insert(SpecialWord,"then","T")		# conditional
> 	insert(SpecialWord,"else","E")		# conditional
> 	insert(SpecialWord,"fi","F")		# conditional
> 	insert(SpecialWord,"every","W")		# iteration
> 	insert(SpecialWord,"while","W")		# iteration
> 	insert(SpecialWord,"when","W")		# monitor events
757,768c700,711
< 	#insert(SpecialWord,"and","j")		# logic
< 	#insert(SpecialWord,"or","j")		# logic
< 	#insert(SpecialWord,"not","N")		# complement wrt existent 
< 	#insert(SpecialWord,"non","N") 		# complement wrt genus
< 
< 	#insert(SpecialWord,"a","Q")		# quantifier
< 	#insert(SpecialWord,"all","G")		# ingroup quantifier
< 	#insert(SpecialWord,"any","G")		# exgroup quantifier
< 	#insert(SpecialWord,"either","G")	# exgroup quantifier
< 	#insert(SpecialWord,"no","Q")		# quantifier
< 	#insert(SpecialWord,"some","Q")		# quantifier
< 	#insert(SpecialWord,"the","Q")		# quantifier
---
> 	insert(SpecialWord,"and","j")		# logic
> 	insert(SpecialWord,"or","j")		# logic
> 	insert(SpecialWord,"not","N")		# complement wrt existent 
> 	insert(SpecialWord,"non","N") 		# complement wrt genus
> 
> 	insert(SpecialWord,"a","Q")		# quantifier
> 	insert(SpecialWord,"all","G")		# ingroup quantifier
> 	insert(SpecialWord,"any","G")		# exgroup quantifier
> 	insert(SpecialWord,"either","G")	# exgroup quantifier
> 	insert(SpecialWord,"no","Q")		# quantifier
> 	insert(SpecialWord,"some","Q")		# quantifier
> 	insert(SpecialWord,"the","Q")		# quantifier
771c714
< 	#insert(SpecialWord,"changes","C")	# event-attribute
---
> 	insert(SpecialWord,"changes","C")	# event-attribute
775,777c718,720
< 	#insert(SpecialWord,"forSome","W")	# first order logic
< 	#insert(SpecialWord,"forAll","W")	# first order logic
< 	#insert(SpecialWord,"implies","J")	# logic
---
> 	insert(SpecialWord,"forSome","W")	# first order logic
> 	insert(SpecialWord,"forAll","W")	# first order logic
> 	insert(SpecialWord,"implies","J")	# logic
799,800c742,743
< 	#insert(SpecialWord,"for","j")		# conjunction
< 	#insert(SpecialWord,"vs.","j")		# conjunction
---
> 	insert(SpecialWord,"for","j")		# conjunction
> 	insert(SpecialWord,"vs.","j")		# conjunction
1453a1397
> static semicolon
1467a1412
>   semicolon := integer(1)
1472c1417,1421
< 		bracket + brace + angle + paren
---
> 		bracket + brace + angle + paren +
> 		semicolon
> 	}
> ("html"|"htm"|"xml"|"rdf"): {
> 	gcount := angle
1474d1422
< ("html"|"htm"|"xml"|"rdf"): { gcount := angle }
1486,1495c1434,1444
<   beginend := integer(0)
<   iffi     := integer(0)
<   dodone   := integer(0)
<   everydo  := integer(0)
<   whendo   := integer(0)
<   whiledo  := integer(0)
<   bracket  := integer(0)
<   brace    := integer(0)
<   angle    := integer(0)
<   paren    := integer(0)
---
>   beginend  := integer(0)
>   iffi      := integer(0)
>   dodone    := integer(0)
>   everydo   := integer(0)
>   whendo    := integer(0)
>   whiledo   := integer(0)
>   bracket   := integer(0)
>   brace     := integer(0)
>   angle     := integer(0)
>   paren     := integer(0)
>   semicolon := integer(1)
1524a1474,1475
> 
> ";":     { semicolon -:= 1 }
1530c1481,1482
< 		bracket + brace + angle + paren
---
> 		bracket + brace + angle + paren +
> 		semicolon
1550c1502
< #    , ; \ [ { ( <
---
> #    , [ { ( < \
1558c1510
< local cont,icomplete
---
> local nocont,cont,icomplete
1568c1520,1521
< 	cont := '\\' ++ '!,;&|~' ++ '[{(<' ++ 'ACDEGHIiJPpQRTWYZ' ++ '='
---
> 	nocont := ';' ++ '>'
> 	cont := '\\' ++ '!,&|~' ++ '[{(<' ++ 'ACDEGHIiJPpQRTWYZ' ++ '='
1571a1525
> 	nocont := '>'
1578a1533
> 	nocont := ''
1582a1538
> 	nocont := '>'
1586a1543
> 	nocont := ''
1596d1552
< #DEBUG := "CONTINUE"
1613c1569,1575
<     if upto(tlast,cont) | (icomplete > 0) then {
---
>     if upto(tlast,nocont) then {
> 	# no continuation
> 	if DEBUG=="CONTINUE" then {
> 	  writes_type(mybug,tlast,info||"no continutaion: tlast")
> 	  writes_type(mylog,tlast,info||"no continutaion: tlast")
> 	}
>     } else if upto(tlast,cont) | (icomplete > 0) then {
1619c1581
< 	if xline := prompt(infd) then {
---
> 	if xline := prompt(infd,"<continue> ") then {
