summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2011-03-24 04:25:32 +0000
committerAdrian Thurston <thurston@complang.org>2011-03-24 04:25:32 +0000
commitfb5430c9c2cf2ad1570150316e969ab142288b58 (patch)
tree62095cd9abf26b59771ea7f3d4f3afd88689a15e /test
parent6b6229980be2b0034b49eb66f00d62325e781882 (diff)
downloadcolm-fb5430c9c2cf2ad1570150316e969ab142288b58.tar.gz
Test cases use pattern-style parameters and declarations. refs #241.
Diffstat (limited to 'test')
-rw-r--r--test/accum1.lm6
-rw-r--r--test/accum2.lm10
-rw-r--r--test/accum3.lm7
-rw-r--r--test/accumbt.lm4
-rw-r--r--test/argv2.lm6
-rw-r--r--test/backtrack1.lm4
-rw-r--r--test/backtrack2.lm2
-rw-r--r--test/btscan1.lm2
-rw-r--r--test/btscan2.lm2
-rw-r--r--test/commitbt.lm12
-rw-r--r--test/construct1.lm2
-rw-r--r--test/construct3.lm2
-rw-r--r--test/constructex.lm6
-rw-r--r--test/context1.lm10
-rw-r--r--test/context2.lm12
-rw-r--r--test/context3.lm10
-rw-r--r--test/counting1.lm6
-rw-r--r--test/counting2.lm10
-rw-r--r--test/counting3.lm12
-rw-r--r--test/counting4.lm12
-rw-r--r--test/cxx/cxx.lm248
-rw-r--r--test/div.lm2
-rw-r--r--test/dns.lm63
-rw-r--r--test/func.lm6
-rw-r--r--test/heredoc.lm4
-rw-r--r--test/html/html.lm32
-rw-r--r--test/http/http.lm2
-rw-r--r--test/island.lm4
-rw-r--r--test/liftattrs.lm4
-rw-r--r--test/mailbox.lm2
-rw-r--r--test/matchex.lm2
-rw-r--r--test/maxlen.lm6
-rw-r--r--test/mutualrec.lm4
-rw-r--r--test/nestedcomm.lm2
-rw-r--r--test/python/python.lm16
-rw-r--r--test/rediv.lm2
-rw-r--r--test/reparse.lm6
-rw-r--r--test/repeat.lm2
-rw-r--r--test/rubyhere.lm10
-rw-r--r--test/scope1.lm10
-rw-r--r--test/string.lm2
-rw-r--r--test/superid.lm6
-rw-r--r--test/tags.lm6
-rw-r--r--test/til.lm6
-rw-r--r--test/translate1.lm4
-rw-r--r--test/translate2.lm4
-rw-r--r--test/travs1.lm18
-rw-r--r--test/treecmp1.lm4
-rw-r--r--test/undofrag1.lm6
-rw-r--r--test/undofrag2.lm4
-rw-r--r--test/undofrag3.lm4
-rw-r--r--test/xml/xml.lm2
52 files changed, 314 insertions, 316 deletions
diff --git a/test/accum1.lm b/test/accum1.lm
index 11c75ed3..d6ba73d8 100644
--- a/test/accum1.lm
+++ b/test/accum1.lm
@@ -12,19 +12,19 @@ def item
def start
[item*]
-start Input = parse start( stdin )
+Input: start = parse start( stdin )
accum output
[start]
-output Output = construct output []
+Output: output = construct output []
for Id: id in Input {
Output <<
"( [Id] )
}
-start S = Output.finish()
+S: start = Output.finish()
print( S, '\n' )
diff --git a/test/accum2.lm b/test/accum2.lm
index e9ec27c5..7570433f 100644
--- a/test/accum2.lm
+++ b/test/accum2.lm
@@ -1,8 +1,8 @@
context ctx
{
- int i
- int j
- int k
+ i: int
+ j: int
+ k: int
lex start
{
@@ -27,10 +27,10 @@ context ctx
parser start_parser [ctx::start]
-start_parser SP = cons start_parser[]
+SP: start_parser = cons start_parser[]
SP.ctx = cons ctx []
SP << stdin
-ctx::start Input = SP.finish()
+Input: ctx::start = SP.finish()
print( Input, '\n' )
diff --git a/test/accum3.lm b/test/accum3.lm
index 2ec408cd..40508a0d 100644
--- a/test/accum3.lm
+++ b/test/accum3.lm
@@ -23,14 +23,13 @@ def args
accum arg_parser [args]
-arg_parser ArgParser =
-construct arg_parser []
+ArgParser: arg_parser = cons arg_parser []
-argv_list ArgV = argv
+ArgV: argv_list ArgV = argv
for A: str in ArgV
ArgParser << [A '\0']
-args Args = ArgParser.finish()
+Args: args = ArgParser.finish()
print_xml( Args )
diff --git a/test/accumbt.lm b/test/accumbt.lm
index 51a02746..09abf8a6 100644
--- a/test/accumbt.lm
+++ b/test/accumbt.lm
@@ -27,7 +27,7 @@ def start
accum input [start]
-input I = construct input []
+I: input = construct input []
I << " id "
I << " 77 "
@@ -36,7 +36,7 @@ I << " \"hello\" "
I << " dude "
I << " dude\n"
-start S = I.finish()
+S: start = I.finish()
S = match S
~id 77 88 "hello" dude dude
print_xml( S )
diff --git a/test/argv2.lm b/test/argv2.lm
index e0c68506..318a3f14 100644
--- a/test/argv2.lm
+++ b/test/argv2.lm
@@ -39,14 +39,14 @@ def args
# The argument parser. Using an accumulator so we can send nulls after each
# arg.
accum arg_parser [args]
-arg_parser ArgParser =
+ArgParser: arg_parser =
construct arg_parser []
# Parse the args and extract the result into Args.
-argv_list ArgV = argv
+ArgV: argv_list = argv
for A: str in ArgV
ArgParser << [A '\0']
-args Args = ArgParser.finish()
+Args: args = ArgParser.finish()
# Process the args.
for Item: item in Args {
diff --git a/test/backtrack1.lm b/test/backtrack1.lm
index 0f3d8e88..2485544e 100644
--- a/test/backtrack1.lm
+++ b/test/backtrack1.lm
@@ -19,6 +19,6 @@ def E
def start
[E]
-start S = parse start( stdin )
-start R = match S ~ 9 + 9
+S: start = parse start( stdin )
+R: start = match S ~ 9 + 9
print_xml( R )
diff --git a/test/backtrack2.lm b/test/backtrack2.lm
index d5dadd7e..fd06ad77 100644
--- a/test/backtrack2.lm
+++ b/test/backtrack2.lm
@@ -20,5 +20,5 @@ def prods
def start
[prods]
-start S = parse start( stdin )
+S: start = parse start( stdin )
print_xml( match S "!aa bb cc dd" )
diff --git a/test/btscan1.lm b/test/btscan1.lm
index ac7914c2..0aae89e3 100644
--- a/test/btscan1.lm
+++ b/test/btscan1.lm
@@ -28,7 +28,7 @@ def item
def btscan
[item*]
-btscan P = parse btscan( stdin )
+P: btscan P = parse btscan( stdin )
match P ~!abb !abba !aab
print_xml(P)
diff --git a/test/btscan2.lm b/test/btscan2.lm
index a72ab251..14413c6f 100644
--- a/test/btscan2.lm
+++ b/test/btscan2.lm
@@ -30,7 +30,7 @@ def btscan
parser btscan_parser [btscan]
-btscan_parser Parser = cons btscan_parser []
+Parser: btscan_parser = cons btscan_parser []
Parser << "!ab"
Parser << "b "
diff --git a/test/commitbt.lm b/test/commitbt.lm
index f17a1ab1..42226e60 100644
--- a/test/commitbt.lm
+++ b/test/commitbt.lm
@@ -80,10 +80,10 @@ def factor
def alphabet_num
[uint]
-global int i
+global i: int
def suint
- int i
+ i: int
[uint]
{
#lhs.i = 0
@@ -95,11 +95,11 @@ def sub
[suint* '*']
token item
- sub S
+ S: sub
/[0-9]+/
{
- str M = input.pull(match_length)
- sub S = parse_stop sub(input)
+ M: str = input.pull(match_length)
+ S: sub = parse_stop sub(input)
input.push( make_token( typeid item, M, S ) )
}
@@ -109,5 +109,5 @@ def stuff
[item* '!' EOL]
| [sub]
-stuff S = parse stuff( stdin )
+S: stuff = parse stuff( stdin )
print_xml( S )
diff --git a/test/construct1.lm b/test/construct1.lm
index f16cd48a..f0ed72fd 100644
--- a/test/construct1.lm
+++ b/test/construct1.lm
@@ -11,6 +11,6 @@ lex start
def four_ids
[id id id id]
-four_ids Constructed = construct four_ids "a b c d"
+Constructed: four_ids = construct four_ids "a b c d"
print_xml( Constructed )
diff --git a/test/construct3.lm b/test/construct3.lm
index 174a17f3..02409d9a 100644
--- a/test/construct3.lm
+++ b/test/construct3.lm
@@ -12,5 +12,5 @@ def item [id] | [bigger]
def lang [item*]
-bigger B = construct bigger "( b1 b2 )"
+B: bigger = construct bigger "( b1 b2 )"
print( construct lang "a [B] c", '\n' )
diff --git a/test/constructex.lm b/test/constructex.lm
index 01d71f37..dcf7c4d3 100644
--- a/test/constructex.lm
+++ b/test/constructex.lm
@@ -21,15 +21,15 @@ def item
[tag]
| [id]
-tag PersonTag = parse tag( stdin )
+PersonTag: tag = parse tag( stdin )
match PersonTag
["<person name=" Val:id attr*">" item* "</person>"]
-tag NameTag1 = construct tag
+NameTag1: tag = construct tag
["<name type=person>" Val "</name>"]
-tag NameTag2 = construct tag
+NameTag2: tag = construct tag
"<name type=person>[Val]</name>"
print( NameTag1, '\n' )
diff --git a/test/context1.lm b/test/context1.lm
index 8b1a8f1c..c49b7f88 100644
--- a/test/context1.lm
+++ b/test/context1.lm
@@ -1,8 +1,8 @@
context ctx
{
- int i
- int j
- int k
+ i: int
+ j: int
+ k: int
lex start
{
@@ -28,6 +28,6 @@ context ctx
[item*]
}
-ctx CTX = cons ctx[]
-ctx::start Input = parse ctx::start( CTX, stdin )
+CTX: ctx = cons ctx[]
+Input: ctx::start = parse ctx::start( CTX, stdin )
print( Input, '\n' )
diff --git a/test/context2.lm b/test/context2.lm
index 7118ac5f..570cfa4e 100644
--- a/test/context2.lm
+++ b/test/context2.lm
@@ -11,7 +11,7 @@ context ruby_here
literal '<<', '*', ',', '(', ')', '!'
}
- str HereId
+ HereId: str
token rest_of_line /[^\n]*'\n'/
@@ -19,17 +19,17 @@ context ruby_here
{
ignore /[ \t\n]+/
token here_id
- here_data HereData
+ HereData: here_data
/ident_pattern/
{
# Take the text of the here_id from the input stream.
HereId = input.pull( match_length )
# Get the data up to the rest of the line.
- rest_of_line ROL = parse_stop rest_of_line( ctx, input )
+ ROL: rest_of_line = parse_stop rest_of_line( ctx, input )
# Parse the heredoc data.
- here_data HereData = parse_stop here_data( ctx, input )
+ HereData: here_data = parse_stop here_data( ctx, input )
# Push the rest-of-line data back to the input stream.
input.push( $ROL )
@@ -91,7 +91,7 @@ context ruby_here
[item*]
}
-ruby_here CTX = cons ruby_here []
+CTX: ruby_here = cons ruby_here []
-ruby_here::start S = parse ruby_here::start( CTX, stdin )
+S: ruby_here::start = parse ruby_here::start( CTX, stdin )
print_xml(S)
diff --git a/test/context3.lm b/test/context3.lm
index 58c96de4..f0a75335 100644
--- a/test/context3.lm
+++ b/test/context3.lm
@@ -1,8 +1,8 @@
context ctx
{
- int i
- int j
- int k
+ i: int
+ j: int
+ k: int
lex start
{
@@ -35,8 +35,8 @@ context ctx
[item*]
}
-ctx CTX = cons ctx []
-ctx::start Input = parse ctx::start( CTX, stdin )
+CTX: ctx = cons ctx []
+Input: ctx::start = parse ctx::start( CTX, stdin )
print( Input, '\n' )
diff --git a/test/counting1.lm b/test/counting1.lm
index 985cfc6c..af302c1b 100644
--- a/test/counting1.lm
+++ b/test/counting1.lm
@@ -24,7 +24,7 @@ lex start
# Global Data
#
-global int target
+global target: int
#
# Productions
@@ -45,7 +45,7 @@ def item
# Type definition for the count_items nonterminal.
def count_items
- int count
+ count: int
# List production one. The condition stops the
# greedy list when it has gone too far.
@@ -82,7 +82,7 @@ def start
match List [Count:number Items:count_items]
print( 'num items: ', Count.data.atoi(), '\n' )
- int i = 1
+ i: int = 1
for Item:item in Items {
print( ' item ', i, ': ', Item, '\n' )
i = i + 1
diff --git a/test/counting2.lm b/test/counting2.lm
index 8f76b13a..bc1a5f0c 100644
--- a/test/counting2.lm
+++ b/test/counting2.lm
@@ -33,8 +33,8 @@ def item
# List production one. The condition stops the
# greedy list when it has gone too far.
def count_items
- int target
- int count
+ target: int
+ count: int
[count_items item]
{
@@ -50,7 +50,7 @@ def count_items
# List production two, the base.
| [number]
{
- match lhs [Number:number]
+ match lhs [Number: number]
lhs.target = Number.data.atoi()
lhs.count = 0
}
@@ -69,11 +69,11 @@ def counted_list
def start
[counted_list*]
{
- for List:counted_list in lhs {
+ for List: counted_list in lhs {
match List [CountItems:count_items]
print( 'num items: ', CountItems.target, '\n' )
- int i = 1
+ i: int = 1
for Item:item in CountItems {
print( ' item ', i, ': ', Item, '\n' )
i = i + 1
diff --git a/test/counting3.lm b/test/counting3.lm
index b44a7e79..cb7ff7e6 100644
--- a/test/counting3.lm
+++ b/test/counting3.lm
@@ -26,8 +26,8 @@ lex start
# Global Data
#
-global int target
-global int count
+global target: int
+global count: int
#
# Productions
@@ -78,12 +78,12 @@ def start
[counted_list*]
{
- for List:counted_list in lhs {
- match List [Count:number Items:count_items]
+ for List: counted_list in lhs {
+ match List [Count: number Items: count_items]
print( 'num items: ', Count.data.atoi(), '\n' )
- int i = 1
- for Item:item in Items {
+ i: int = 1
+ for Item: item in Items {
print( ' item ', i, ': ', Item, '\n' )
i = i + 1
}
diff --git a/test/counting4.lm b/test/counting4.lm
index b1a75130..f7e43a17 100644
--- a/test/counting4.lm
+++ b/test/counting4.lm
@@ -26,8 +26,8 @@ lex start
# Global Data
#
-global int target
-global int count
+global target: int
+global count: int
#
# Productions
@@ -73,12 +73,12 @@ def counted_list
def start
[counted_list*]
{
- for List:counted_list in lhs {
- match List [Count:number Items:count_items]
+ for List: counted_list in lhs {
+ match List [Count: number Items: count_items]
print( 'num items: ', Count.data.atoi(), '\n' )
- int i = 1
- for Item:item in Items {
+ i: int = 1
+ for Item: item in Items {
print( ' item ', i, ': ', Item, '\n' )
i = i + 1
}
diff --git a/test/cxx/cxx.lm b/test/cxx/cxx.lm
index 7b42c690..1bc76c14 100644
--- a/test/cxx/cxx.lm
+++ b/test/cxx/cxx.lm
@@ -7,46 +7,46 @@ map object_map [str object_list]
# Language objects.
def lang_object
- int typeId
- str name
+ typeId: int
+ name: str
# If the object is a typedef, this points to the real object.
- ptr lang_object typedefOf
+ typedefOf: ptr lang_object
- object_map objectMap
- object_list inherited
- ptr lang_object lookupParent
- ptr lang_object specializationOf
+ objectMap: object_map
+ inherited: object_list
+ lookupParent: ptr lang_object
+ specializationOf: ptr lang_object
[]
# This structure is used to keep track of information necessary to make a
# declaration. While parsing a declaration it records the declaration's
# attributes.
def declaration_data
- int isTypedef
- int isFriend
- int isTemplate
+ isTypedef: int
+ isFriend: int
+ isTemplate: int
- ptr lang_object typeObj
+ typeObj: ptr lang_object
[]
def declarator_data
- ptr lang_object qualObj
- ptr lang_object pdcScope
- ptr lang_object lookupObj
+ qualObj: ptr lang_object
+ pdcScope: ptr lang_object
+ lookupObj: ptr lang_object
[]
list declaration_data_list [declaration_data]
list declarator_data_list [declarator_data]
# Constants for language object types.
-global int NamespaceType = typeid namespace_id
-global int ClassType = typeid class_id
-global int TemplateClassType = typeid templ_class_id
-global int EnumType = typeid enum_id
-global int IdType = typeid identifier
-global int TypedefType = typeid typedef_id
-global int TemplateIdType = typeid template_id
+global NamespaceType: int = typeid namespace_id
+global ClassType: int = typeid class_id
+global TemplateClassType: int = typeid templ_class_id
+global EnumType: int = typeid enum_id
+global IdType: int = typeid identifier
+global TypedefType: int = typeid typedef_id
+global TemplateIdType: int = typeid template_id
# Object stack definition. Uses references to objects.
list object_list [ptr lang_object]
@@ -59,21 +59,21 @@ list int_stack [int]
#
# Object stacks.
-global object_list curNamespace = construct object_list []
-global object_list declNs = construct object_list []
-global object_list lookupNs = construct object_list []
-global object_list qualNs = construct object_list []
-global object_list templateParamNs = construct object_list []
+global curNamespace: object_list = construct object_list []
+global declNs: object_list = construct object_list []
+global lookupNs: object_list = construct object_list []
+global qualNs: object_list = construct object_list []
+global templateParamNs: object_list = construct object_list []
# Declaration, declarator data.
-global declaration_data_list declarationData = construct declaration_data_list []
-global declarator_data_list declaratorData = construct declarator_data_list []
+global declarationData: declaration_data_list = construct declaration_data_list []
+global declaratorData: declarator_data_list = construct declarator_data_list []
# Template declarations
-global int_stack templDecl = construct int_stack []
+global templDecl: int_stack = construct int_stack []
# Root namespace object
-global ptr lang_object rootNamespace = createLangObject( NamespaceType,
+global rootNamespace: ptr lang_object = createLangObject( NamespaceType,
'<root_namespace>', nil )
# Initialize the namespace and declaration stacks with the root namespace
@@ -93,11 +93,11 @@ declarationData.push( construct declaration_data(
#
# Lookup the token in the members of an object.
-ptr lang_object lookupInObject( ptr lang_object obj, str name )
+ptr lang_object lookupInObject( obj: ptr lang_object name: str )
{
# LOG print( ' looking in ', obj->name, '\n' )
- object_list ol = obj->objectMap.find( name )
+ ol: object_list = obj->objectMap.find( name )
if ol {
# LOG print( ' * found an object: ', ol.head, '\n' )
return ol.head
@@ -108,15 +108,15 @@ ptr lang_object lookupInObject( ptr lang_object obj, str name )
# Lookup in an object and all the objects beneath it in the inheritance
# tree.
-ptr lang_object lookupWithInheritance( ptr lang_object obj, str name )
+ptr lang_object lookupWithInheritance( obj: ptr lang_object name: str )
{
- ptr lang_object found = lookupInObject( obj, name )
+ found: ptr lang_object = lookupInObject( obj, name )
if found
return found
- object_list localObjInherited = obj->inherited
+ localObjInherited: object_list = obj->inherited
for II: ptr lang_object in localObjInherited {
- ptr lang_object inh = II
+ inh: ptr lang_object = II
# First check if the inherited object is the one we are after.
if inh->name == name && inh->typeId == ClassType {
@@ -133,12 +133,12 @@ ptr lang_object lookupWithInheritance( ptr lang_object obj, str name )
return nil
}
-ptr lang_object unqualifiedLookup( str name )
+ptr lang_object unqualifiedLookup( name: str )
{
- ptr lang_object found
+ found: ptr lang_object
# Start with the objects in the templateParamNs.
- object_list localTemplateParamNs = templateParamNs
+ localTemplateParamNs: object_list = templateParamNs
for TemplParaObjIter: ptr lang_object in rev_child(localTemplateParamNs) {
found = lookupWithInheritance( TemplParaObjIter, name )
if found
@@ -148,7 +148,7 @@ ptr lang_object unqualifiedLookup( str name )
if !found {
# Iterator over the objects starting at the head of the lookup stack
# and going up through the lookup parents.
- ptr lang_object lookupIn = lookupNs.top
+ lookupIn: ptr lang_object = lookupNs.top
while lookupIn {
found = lookupWithInheritance( lookupIn, name )
if found
@@ -204,14 +204,14 @@ lex start
# Identifiers
token lookup_id
- ptr lang_object obj
- ptr lang_object qualObj
+ obj: ptr lang_object
+ qualObj: ptr lang_object
/( [a-zA-Z_] [a-zA-Z0-9_]* )/
{
- str name = match_text
- ptr lang_object found = nil
- ptr lang_object qualObj = nil
+ name: str = match_text
+ found: ptr lang_object = nil
+ qualObj: ptr lang_object = nil
if qualNs.top {
# LOG print( 'qualified lookup of ', name, '\n' )
@@ -229,11 +229,11 @@ lex start
}
# If no match, return an Unknown ID
- int id = typeid unknown_id
+ id: int = typeid unknown_id
if found
id = found->typeId
- any LookupId = make_token( typeid lookup_id,
+ LookupId: any = make_token( typeid lookup_id,
input.pull(match_length), found, qualObj )
input.push( make_tree( id, LookupId ) )
@@ -265,9 +265,9 @@ lex start
# Support functions
#
-ptr lang_object createLangObject( int typeId, str name, ptr lang_object lookupParent )
+ptr lang_object createLangObject( typeId: int name: str lookupParent: ptr lang_object )
{
- ptr lang_object obj = new construct lang_object(
+ obj: ptr lang_object = new construct lang_object(
typeId: typeId,
name: name,
objectMap: construct object_map [],
@@ -277,9 +277,9 @@ ptr lang_object createLangObject( int typeId, str name, ptr lang_object lookupPa
}
# Building the language object tree.
-int insertObject( ptr lang_object definedIn, str name, ptr lang_object obj )
+int insertObject( definedIn: ptr lang_object name: str obj: ptr lang_object )
{
- object_list ol = definedIn->objectMap.find( name )
+ ol: object_list = definedIn->objectMap.find( name )
if !ol {
# Element not in the map already
ol = construct object_list []
@@ -288,12 +288,12 @@ int insertObject( ptr lang_object definedIn, str name, ptr lang_object obj )
definedIn->objectMap.store( name, ol )
}
-ptr lang_object findClass( ptr lang_object inObj, str name )
+ptr lang_object findClass( inObj: ptr lang_object name: str )
{
- object_list ol = inObj->objectMap.find( name )
+ ol: object_list = inObj->objectMap.find( name )
if ol {
for ObjIter: ptr lang_object in ol {
- ptr lang_object obj = ObjIter
+ obj: ptr lang_object = ObjIter
if obj->typeId == ClassType {
return obj
}
@@ -302,12 +302,12 @@ ptr lang_object findClass( ptr lang_object inObj, str name )
return nil
}
-ptr lang_object findTemplateClass( ptr lang_object inObj, str name )
+ptr lang_object findTemplateClass( inObj: ptr lang_object name: str )
{
- object_list ol = inObj->objectMap.find( name )
+ ol: object_list = inObj->objectMap.find( name )
if ol {
for ObjIter: ptr lang_object in ol {
- ptr lang_object obj = ObjIter
+ obj: ptr lang_object = ObjIter
if obj->typeId == TemplateClassType
return obj
}
@@ -366,7 +366,7 @@ def designated_qualifying_name
#
def id_expression
- lookup_id lookupId
+ lookupId: lookup_id
[root_qual_opt nested_name_specifier_opt unknown_id]
{
@@ -382,7 +382,7 @@ def id_expression
{
# Normally the token translation transfers the qualification. Since
# the operator_function_id does not end in a lookup we must do it ourselves.
- ptr lang_object qualObj = qualNs.top
+ qualObj: ptr lang_object = qualNs.top
qualNs.top = nil
lhs.lookupId = construct lookup_id ["x"]
@@ -394,7 +394,7 @@ def id_expression
{
# Normally the token translation transfers the qualification. Since
# the operator_function_id does not } in a lookup we must do it ourselves.
- ptr lang_object qualObj = qualNs.top
+ qualObj: ptr lang_object = qualNs.top
qualNs.top = nil
# Do we need qual reset here becauase operator_function_id does not do it?
@@ -414,7 +414,7 @@ def id_expression
}
def template_name
- lookup_id lookupId
+ lookupId: lookup_id
[template_id templ_arg_open template_argument_list_opt templ_arg_close]
{
@@ -432,7 +432,7 @@ def template_name
#
def class_name
- lookup_id lookupId
+ lookupId: lookup_id
[class_id]
{
@@ -520,7 +520,7 @@ def decl_specifier_sing
}
def type_specifier_seq
- lookup_id lookupId
+ lookupId: lookup_id
[type_specifier_mult_seq_opt type_specifier_sing type_specifier_mult_seq_opt]
{
@@ -528,7 +528,7 @@ def type_specifier_seq
}
def type_specifier_sing
- lookup_id lookupId
+ lookupId: lookup_id
[simple_type_specifier]
{
@@ -571,7 +571,7 @@ def type_specifier_mult_seq
| [type_specifier_mult]
def simple_type_specifier
- lookup_id lookupId
+ lookupId: lookup_id
[simple_type_specifier_name]
{
@@ -607,7 +607,7 @@ def simple_type_specifier
}
def simple_type_specifier_name
- lookup_id lookupId
+ lookupId: lookup_id
[qual_type_name]
{
@@ -632,7 +632,7 @@ def simple_type_specifier_kw
| ['unsigned']
def qual_type_name
- lookup_id lookupId
+ lookupId: lookup_id
[root_qual_opt nested_name_specifier_opt type_name]
{
@@ -640,7 +640,7 @@ def qual_type_name
}
def type_name
- lookup_id lookupId
+ lookupId: lookup_id
[class_name]
{
@@ -662,16 +662,16 @@ def type_name
def elaborated_type_specifier
[class_key nested_name_specifier_opt class_head_name]
{
- lookup_id Id = lookup_id in r3
- str name = Id.data
+ Id: lookup_id = lookup_id in r3
+ name: str = Id.data
# Get the ns the class is declared in.
- ptr lang_object parentObj = declNs.top
+ parentObj: ptr lang_object = declNs.top
if Id.qualObj
parentObj = Id.qualObj
# Look for the class in the given scope.
- ptr lang_object declaredClass = findClass( parentObj, name )
+ declaredClass: ptr lang_object = findClass( parentObj, name )
if !declaredClass
declaredClass = findTemplateClass( parentObj, name )
@@ -679,7 +679,7 @@ def elaborated_type_specifier
# LOG print( 'creating new class: ', name, '\n' )
# Class does not exist in the parent scope, create it.
- int nsType = declaredClassType()
+ nsType: int = declaredClassType()
declaredClass = createLangObject( nsType, name, lookupNs.top )
@@ -698,9 +698,9 @@ def elaborated_type_specifier
| ['enum' nested_name_specifier_opt enum_head_name]
{
# TODO: should look for existing enums of the same name.
- lookup_id Id = lookup_id in r3
+ Id: lookup_id = lookup_id in r3
# LOG print( 'creating enumeration ', Id.data, '\n' )
- ptr lang_object enum = createLangObject( EnumType, Id.data, lookupNs.top )
+ enum: ptr lang_object = createLangObject( EnumType, Id.data, lookupNs.top )
insertObject( declNs.top, Id.data, enum )
}
@@ -768,9 +768,9 @@ def enum_specifier
enum_head_name '{' enumerator_list_opt '}']
{
# TODO: should look for existing enums of the same name.
- lookup_id Id = lookup_id in r3
+ Id: lookup_id = lookup_id in r3
# LOG print( 'creating enumeration ', Id.data, '\n' )
- ptr lang_object enum = createLangObject( EnumType, Id.data, lookupNs.top )
+ enum: ptr lang_object = createLangObject( EnumType, Id.data, lookupNs.top )
insertObject( declNs.top, Id.data, enum )
}
@@ -798,15 +798,15 @@ def enumerator_list
def enumerator_definition
[enumerator_id]
{
- lookup_id Id = lookup_id in r1
- ptr lang_object enumId = createLangObject( IdType, Id.data, lookupNs.top )
+ Id: lookup_id = lookup_id in r1
+ enumId: ptr lang_object = createLangObject( IdType, Id.data, lookupNs.top )
insertObject( declNs.top, Id.data, enumId )
}
| [enumerator_id '=' constant_expression]
{
- lookup_id Id = lookup_id in r1
- ptr lang_object enumId = createLangObject( IdType, Id.data, lookupNs.top )
+ Id: lookup_id = lookup_id in r1
+ enumId: ptr lang_object = createLangObject( IdType, Id.data, lookupNs.top )
insertObject( declNs.top, Id.data, enumId )
}
@@ -1104,7 +1104,7 @@ def compound_statement
def compound_begin
[]
{
- ptr lang_object newCompound = createLangObject( 0, '<compound_begin>', lookupNs.top )
+ newCompound: ptr lang_object = createLangObject( 0, '<compound_begin>', lookupNs.top )
lookupNs.push( newCompound )
declNs.push( newCompound )
# LOG print( 'opening <compound>\n' )
@@ -1186,7 +1186,7 @@ def stmt_block_declaration_forms
#
def declarator
- ptr lang_object lookupObj
+ lookupObj: ptr lang_object
[ptr_operator_seq_opt declarator_id decl_array_or_param_rep declarator_end]
{
@@ -1215,16 +1215,16 @@ def decl_array_or_param
def declarator_id
[declarator_id_forms]
{
- str name = r1.lookupId.data
- ptr lang_object qualObj = r1.lookupId.qualObj
+ name: str = r1.lookupId.data
+ qualObj: ptr lang_object = r1.lookupId.qualObj
- ptr lang_object parentObj = declNs.top
+ parentObj: ptr lang_object = declNs.top
if qualObj {
parentObj = qualObj
}
# Decide if we are declaring a constructor/destructor.
- bool isConstructor
+ isConstructor: bool
if parentObj == r1.lookupId.obj {
isConstructor = true
# LOG print( 'making declarator ', name, ' a constructor/destructor\n' )
@@ -1237,7 +1237,7 @@ def declarator_id
# LOG print( 'making declarator ', name, ' a constructor/destructor\n' )
}
- ptr lang_object obj = nil
+ obj: ptr lang_object = nil
if name && !isConstructor && declarationData.top.isFriend == 0 {
if declarationData.top.isTypedef {
obj = createLangObject( TypedefType, name, lookupNs.top )
@@ -1284,7 +1284,7 @@ def declarator_id
# Undoes the setup done by declarator_id and pdc_start.
def declarator_end
- ptr lang_object lookupObj
+ lookupObj: ptr lang_object
[]
{
@@ -1292,8 +1292,8 @@ def declarator_end
# parse a function body it will be needed.
lhs.lookupObj = declaratorData.top.lookupObj
- ptr lang_object pdcScope = declaratorData.top.pdcScope
- ptr lang_object qualObj = declaratorData.top.qualObj
+ pdcScope: ptr lang_object = declaratorData.top.pdcScope
+ qualObj: ptr lang_object = declaratorData.top.qualObj
declaratorData.pop()
@@ -1310,7 +1310,7 @@ def declarator_end
}
def declarator_id_forms
- lookup_id lookupId
+ lookupId: lookup_id
[id_expression]
{
@@ -1337,7 +1337,7 @@ def declarator_id_forms
}
def type_id
- lookup_id lookupId
+ lookupId: lookup_id
[type_specifier_seq abstract_declarator_opt]
{
@@ -1395,7 +1395,7 @@ def pdc_start
{
if !declaratorData.top.pdcScope {
# We are going to need a scope for the declarator.
- ptr lang_object pdcScope = createLangObject( 0, '<pdc_scope>', lookupNs.top )
+ pdcScope: ptr lang_object = createLangObject( 0, '<pdc_scope>', lookupNs.top )
lookupNs.push( pdcScope )
declNs.push( pdcScope )
@@ -1479,7 +1479,7 @@ def function_body
def function_body_begin
[]
{
- ptr lang_object newFunctionBody = createLangObject( 0,
+ newFunctionBody: ptr lang_object = createLangObject( 0,
'<function_body_begin>', lookupNs.top )
lookupNs.push( newFunctionBody )
declNs.push( newFunctionBody )
@@ -1533,10 +1533,10 @@ def class_specifier
def class_head
[class_key]
{
- int nsType = declaredClassType()
+ nsType: int = declaredClassType()
# LOG print( 'creating new anonymous class\n' )
- ptr lang_object newClass = createLangObject( nsType,
+ newClass: ptr lang_object = createLangObject( nsType,
'<anon_class>', lookupNs.top )
lookupNs.push( newClass )
declNs.push( newClass )
@@ -1544,16 +1544,16 @@ def class_head
| [class_key nested_name_specifier_opt class_head_name]
{
- lookup_id Id = lookup_id in r3
- str name = Id.data
+ Id: lookup_id = lookup_id in r3
+ name: str = Id.data
# Get the ns the class is declared in.
- ptr lang_object parentObj = declNs.top
+ parentObj: ptr lang_object = declNs.top
if Id.qualObj
parentObj = Id.qualObj
# Look for the class in the given scope.
- ptr lang_object declaredClass = findClass( parentObj, name )
+ declaredClass: ptr lang_object = findClass( parentObj, name )
if !declaredClass
declaredClass = findTemplateClass( parentObj, name )
@@ -1561,7 +1561,7 @@ def class_head
# LOG print( 'creating new class: ', name, '\n' )
# Class does not exist in the parent scope, create it.
- int nsType = declaredClassType()
+ nsType: int = declaredClassType()
declaredClass = createLangObject( nsType, name, lookupNs.top )
@@ -1581,18 +1581,18 @@ def class_head
templ_arg_open template_argument_list_opt templ_arg_close]
{
match r3 [Id: lookup_id]
- str id = Id.data
- ptr lang_object classObj = Id.obj
+ id: str = Id.data
+ classObj: ptr lang_object = Id.obj
# TODO: Try to find the specializaition in the template class object.
# TypeList typeList;
# makeTypeList( typeList, $6->last );
- ptr lang_object declaredClass
+ declaredClass: ptr lang_object
#declaredClass = classObj->findSpecExact( typeList );
if !declaredClass {
# LOG print( 'making new template specialization\n' )
- int nsType = declaredClassType()
+ nsType: int = declaredClassType()
declaredClass = createLangObject( nsType, id, lookupNs.top )
# LOG print( 'declaredClass: ', declaredClass, '\n' )
declaredClass->specializationOf = classObj
@@ -1707,14 +1707,14 @@ def access_specifier_opt
def using_declaration
['using' id_expression ';']
{
- ptr lang_object obj = r2.lookupId.obj
+ obj: ptr lang_object = r2.lookupId.obj
if obj
insertObject( declNs.top, obj->name, obj )
}
| ['using' type_id ';']
{
- ptr lang_object obj = r2.lookupId.obj
+ obj: ptr lang_object = r2.lookupId.obj
if obj
insertObject( declNs.top, obj->name, obj )
}
@@ -1727,8 +1727,8 @@ def using_directive
# using namespaces. A more sophisticated and complete guard would look
# for longer cycles as well. Note that even gcc 3.3.5 does not bother.
match r5 [Id: lookup_id]
- ptr lang_object usingObject = Id.obj
- ptr lang_object inObject = declNs.top
+ usingObject: ptr lang_object = Id.obj
+ inObject: ptr lang_object = declNs.top
if usingObject != inObject
inObject->inherited.append( usingObject )
}
@@ -1749,7 +1749,7 @@ def base_specifier_list
[base_specifier_list ',' base_specifier]
| [base_specifier]
-int addBaseSpecifier( ptr lang_object inObject, ptr lang_object inheritedObject )
+int addBaseSpecifier( inObject: ptr lang_object inheritedObject: ptr lang_object )
{
# Resolve typedefs.
if inheritedObject->typeId == TypedefType
@@ -1892,7 +1892,7 @@ def tpl_start
[]
{
# Create a new scope for the template parameters.
- ptr lang_object newTemplateParamScope =
+ newTemplateParamScope: ptr lang_object =
createLangObject( 0, '<tpl_start>', lookupNs.top )
templateParamNs.push( newTemplateParamScope )
}
@@ -1932,10 +1932,10 @@ def templ_simple_type_specifier
def type_parameter
['class' type_param_id type_param_init_opt]
{
- lookup_id Id = lookup_id in r2
+ Id: lookup_id = lookup_id in r2
if Id {
# The lookup ns should be a template param scope.
- ptr lang_object newClass =
+ newClass: ptr lang_object =
createLangObject( ClassType, Id.data, lookupNs.top )
insertObject( templateParamNs.top, Id.data, newClass )
}
@@ -1943,10 +1943,10 @@ def type_parameter
| ['typename' type_param_id type_param_init_opt]
{
- lookup_id Id = lookup_id in r2
+ Id: lookup_id = lookup_id in r2
if Id {
# The lookup ns should be a template param scope.
- ptr lang_object newClass =
+ newClass: ptr lang_object =
createLangObject( ClassType, Id.data, lookupNs.top )
insertObject( templateParamNs.top, Id.data, newClass )
}
@@ -1955,9 +1955,9 @@ def type_parameter
| ['template' '<' tpl_start template_parameter_list '>'
'class' type_param_id templ_type_param_init_opt]
{
- lookup_id Id = lookup_id in r7
+ Id: lookup_id = lookup_id in r7
if Id {
- ptr lang_object newClass =
+ newClass: ptr lang_object =
createLangObject( TemplateClassType, Id.data, lookupNs.top )
insertObject( templateParamNs.top, Id.data, newClass )
}
@@ -2017,7 +2017,7 @@ def original_namespace_definition
def orig_namespace_def_name ['namespace' unknown_id]
{
match r2 [Id: lookup_id]
- ptr lang_object nspace = createLangObject(
+ nspace: ptr lang_object = createLangObject(
NamespaceType, Id.data, lookupNs.top )
# Insert the new object into the dictionary of the parent.
@@ -2051,7 +2051,7 @@ def extension_namespace_definition
def ext_namespace_def_name ['namespace' namespace_id]
{
match r2 [Id: lookup_id]
- ptr lang_object nspace = Id.obj
+ nspace: ptr lang_object = Id.obj
# Push the namespace
curNamespace.push( nspace )
@@ -2069,7 +2069,7 @@ def unnamed_namespace_definition
def unnamed_namespace_def_name ['namespace']
{
- ptr lang_object nspace = createLangObject(
+ nspace: ptr lang_object = createLangObject(
NamespaceType, '<unnamed_namespace>',
lookupNs.top )
@@ -2134,14 +2134,14 @@ def start
# Grammar done.
#
-int printObject( str indent, ptr lang_object obj )
+int printObject( indent: str obj: ptr lang_object )
{
print( indent, obj->name )
if obj->objectMap.length > 0
print( ' {\n' )
- object_map ChildNames = obj->objectMap
+ ChildNames: object_map = obj->objectMap
for MapEl: object_list in child( ChildNames ) {
for Obj: ptr lang_object in MapEl
printObject( indent + ' ', Obj )
@@ -2158,7 +2158,7 @@ int printNamespace()
printObject( '', rootNamespace )
}
-start S = parse start( stdin )
+S: start = parse start( stdin )
print( '***** SUCCESS *****\n' )
print_xml( S )
print( '***** NAMSPACES *****\n' )
diff --git a/test/div.lm b/test/div.lm
index 7c6b5ac8..3c16a396 100644
--- a/test/div.lm
+++ b/test/div.lm
@@ -1,5 +1,5 @@
-int i = 0
+i: int = 0
while ( i < 34 ) {
print( i / 4, '\n' )
i = i + 1
diff --git a/test/dns.lm b/test/dns.lm
index e3cd4fb4..8b5efb45 100644
--- a/test/dns.lm
+++ b/test/dns.lm
@@ -4,8 +4,8 @@ token octet /any/
# Filled in during the parsing of resource records. Determine what RR_UNKNOWN
# translates to.
-global int rr_type_value
-global int rr_class_value
+global rr_type_value: int
+global rr_class_value: int
# Tokens generated from RR_UNKNOWN. Used to pick the kind
# of resource record to attempt to parse.
@@ -29,7 +29,7 @@ token RR_TXT // # 16 text strings
token RR_UNKNOWN
/''/
{
- int id = typeid RR_UNKNOWN
+ id: int = typeid RR_UNKNOWN
if rr_type_value == 1
id = typeid RR_A
elsif rr_type_value == 2
@@ -47,7 +47,7 @@ token RR_UNKNOWN
}
# Convert two octets in network order into an unsigned 16 bit value.
-int network_uord16( octet o1, octet o2 )
+int network_uord16( o1: octet o2: octet )
{
return o1.data.uord8() * 256 + o2.data.uord8()
}
@@ -56,10 +56,10 @@ int network_uord16( octet o1, octet o2 )
def message
[header questions answers authorities additionals]
-global int question_count
-global int answer_count
-global int authority_count
-global int additional_count
+global question_count: int
+global answer_count: int
+global authority_count: int
+global additional_count: int
# Message Header
#
@@ -94,8 +94,7 @@ def header_fields
[octet octet]
def count
- int count
-
+ count: int
[octet octet]
{
lhs.count = network_uord16( r1, r2 )
@@ -116,9 +115,9 @@ def count
#
list count_stack [int]
-global count_stack CL = construct count_stack []
+global CL: count_stack = construct count_stack []
-int start_list( int count )
+int start_list( count: int )
{
CL.push( count )
}
@@ -165,7 +164,7 @@ def name_end
# Zero length ending
[octet]
{
- int val = r1.data.uord8()
+ val: int = r1.data.uord8()
if val != 0 {
reject
}
@@ -177,7 +176,7 @@ def name_end
# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| [octet octet]
{
- int val = r1.data.uord8()
+ val: int = r1.data.uord8()
if val < 64 {
reject
}
@@ -188,7 +187,7 @@ def name_end
#
# How many to get
-global int nbytes
+global nbytes: int
# We use this token to eliminate the lookahead that would be needed to cause a
# reduce of part_len. This forces whatever comes before nbytes to be reduced before
@@ -215,7 +214,7 @@ def part_len
{
# A name part list is terminated either by a zero length or a pointer,
# which must have the two high bits set.
- int count = r1.data.uord8()
+ count: int = r1.data.uord8()
if count == 0 || count >= 64 {
reject
} else {
@@ -259,7 +258,7 @@ def rr_type
}
def rr_class
- int value
+ value: int
[octet octet]
{
rr_class_value = network_uord16( r1, r2 )
@@ -280,7 +279,7 @@ def rdlength
rdata_length = network_uord16( r1, r2 )
}
-global int rdata_length
+global rdata_length: int
def rdata
[RR_UNKNOWN rdata_bytes]
@@ -419,7 +418,7 @@ def start
# Grammar End.
#
-int print_RR_UNKNOWN( start s )
+int print_RR_UNKNOWN( s: start )
{
for I:rdata in s {
if match I [u:RR_UNKNOWN rdata_bytes] {
@@ -428,7 +427,7 @@ int print_RR_UNKNOWN( start s )
}
}
-int print_RR_A( start s )
+int print_RR_A( s: start )
{
for I:rdata in s {
if match I [RR_A o1:octet o2:octet o3:octet o4:octet] {
@@ -440,7 +439,7 @@ int print_RR_A( start s )
map name_map [int name]
-int print_name( name n, name_map m )
+int print_name( n: name m: name_map )
{
for P: name_part in n {
match P [part_len D:nbytes]
@@ -449,40 +448,40 @@ int print_name( name n, name_map m )
for E:name_end in n {
if match E [o1:octet o2:octet] {
- int val = (o1.data.uord8() - 192) * 256 + o2.data.uord8()
+ val: int = (o1.data.uord8() - 192) * 256 + o2.data.uord8()
print( '[', val, ']' )
- name nameInMap = m.find( val )
+ nameInMap: name = m.find( val )
print_name( nameInMap, m )
}
}
}
-int print_all_names( start s )
+int print_all_names( s: start )
{
- for M:message in s {
- name_map m = construct name_map []
+ for M: message in s {
+ m: name_map = construct name_map []
- octet O = octet in M
+ O: octet = octet in M
- for N:name in M {
+ for N: name in M {
match N [name_part* E:name_end]
for NP: name_part* in N {
if match NP [L:octet nbytes name_part*] {
- int messageOffset = L.pos - O.pos
- name n = construct name [NP E]
+ messageOffset: int = L.pos - O.pos
+ n: name = construct name [NP E]
m.insert( messageOffset, n )
}
}
}
- for I:name in M {
+ for I: name in M {
print_name( I, m )
print( '\n' )
}
}
}
-start S = parse start( stdin )
+S: start = parse start( stdin )
print_all_names( S )
print( '*** SUCCESS ***\n' )
diff --git a/test/func.lm b/test/func.lm
index fc8f79d2..00aa05d4 100644
--- a/test/func.lm
+++ b/test/func.lm
@@ -18,14 +18,14 @@ def struct
def program
[struct*]
-int func( program P )
+int func( P: program )
{
}
int main()
{
- stream InputFile = open( 'func.in', "r" )
- program P = parse program( InputFile )
+ InputFile: stream = open( 'func.in', "r" )
+ P: program = parse program( InputFile )
func( P )
print( P )
}
diff --git a/test/heredoc.lm b/test/heredoc.lm
index 234e2472..a8f7e149 100644
--- a/test/heredoc.lm
+++ b/test/heredoc.lm
@@ -28,7 +28,7 @@ def here_name
HereId = $r1
}
-global str HereId
+global HereId: str
def here_data
[here_data_item*]
@@ -42,5 +42,5 @@ def heredoc
[here_name here_data here_close id nl]
-heredoc S = parse heredoc(stdin)
+S: heredoc = parse heredoc(stdin)
print_xml(S)
diff --git a/test/html/html.lm b/test/html/html.lm
index cf9e4217..46789900 100644
--- a/test/html/html.lm
+++ b/test/html/html.lm
@@ -62,11 +62,11 @@ lex close_id
{
# If it is in the tag stack then it is a close_id. If not then it's a
# stray_close_id.
- int send_id = typeid stray_close_id
+ send_id: int = typeid stray_close_id
- tag_stack LocalTagStack = TagStack
- for Tag:tag_id in LocalTagStack {
- tag_id T = Tag
+ LocalTagStack: tag_stack = TagStack
+ for Tag: tag_id in LocalTagStack {
+ T: tag_id = Tag
if match_text == T.data {
send_id = typeid close_id
break
@@ -85,7 +85,7 @@ def tag_stack
[tag_id tag_stack]
| []
-global tag_stack TagStack = construct tag_stack []
+global TagStack: tag_stack = construct tag_stack []
#
# Document Type
@@ -194,13 +194,13 @@ def start
# END GRAMMAR
#
-int addDefaultAltTags( ref start Start )
+int addDefaultAltTags( Start: ref start )
{
for T: open_tag in Start {
require T
["<img" AttrList: attr* '>']
- bool haveAlt = false
+ haveAlt: bool = false
for A: attr in T {
if match A ["alt=" attr_val]
haveAlt = true
@@ -218,7 +218,7 @@ int addDefaultAltTags( ref start Start )
}
}
-int printLinks( start Start )
+int printLinks( Start: start )
{
for A:tag in Start {
require A
@@ -232,19 +232,19 @@ int printLinks( start Start )
}
-bool should_close( tag_id TI )
+bool should_close( TI: tag_id )
{
return true
}
-bool should_flatten( tag_id TI )
+bool should_flatten( TI: tag_id )
{
return true
}
# Finds unclosed tags and puts the content after the tag. Afterwards
# all unclosed tags will be empty 'inside'.
-int flatten( ref start Start )
+int flatten( Start: ref start )
{
for TL: item* in Start {
require TL
@@ -266,7 +266,7 @@ int flatten( ref start Start )
}
}
- opt_close_tag EmptyCloseTag =
+ EmptyCloseTag: opt_close_tag =
construct opt_close_tag []
# Close the tag and put inside after it.
@@ -276,7 +276,7 @@ int flatten( ref start Start )
}
}
-int close( ref start Start )
+int close( Start: ref start )
{
for TL: item in Start {
require TL
@@ -287,9 +287,9 @@ int close( ref start Start )
if should_close( TagId )
{
- close_id CloseId = parse close_id (TagId.data)
+ CloseId: close_id = parse close_id( TagId.data )
- opt_close_tag CloseTag =
+ CloseTag: opt_close_tag =
construct opt_close_tag ['</' CloseId '>']
# Close the tag and put inside after it.
@@ -299,7 +299,7 @@ int close( ref start Start )
}
}
-start HTML = parse start( stdin )
+HTML: start = parse start( stdin )
flatten( HTML )
print_xml( HTML )
printLinks( HTML )
diff --git a/test/http/http.lm b/test/http/http.lm
index d914ab6f..39c56206 100644
--- a/test/http/http.lm
+++ b/test/http/http.lm
@@ -58,7 +58,7 @@ def header
def request
[request_line header* CRLF]
-request R = parse_stop request( stdin )
+R: request = parse_stop request( stdin )
print( 'HTTP/1.0 200 OK\r\n' )
print( 'Date: Fri, 31 Dec 1999 23:59:59 GMT\r\n' )
diff --git a/test/island.lm b/test/island.lm
index 6c86d2ca..abb2b7f2 100644
--- a/test/island.lm
+++ b/test/island.lm
@@ -50,8 +50,8 @@ def top_item
def start
[top_item*]
-start S = parse start( stdin )
-print_xml(S)
+S: start = parse start( stdin )
+print_xml( S )
#pattern start
# ~class { func() { func() { 1+{2}} } } func() {{a}}
diff --git a/test/liftattrs.lm b/test/liftattrs.lm
index 305a805b..5224e4fa 100644
--- a/test/liftattrs.lm
+++ b/test/liftattrs.lm
@@ -43,13 +43,13 @@ def item_list
[item_list tag]
| []
-item_list IL = parse item_list(stdin)
+IL: item_list = parse item_list(stdin)
# Get the item list
match IL [RootItemList: item_list]
# List for collecting the attrs we pull out.
-attr_list CollectedAttrs = construct attr_list []
+CollectedAttrs: attr_list = construct attr_list []
# Iterate through all attributes
for AttrListIter:attr_list in RootItemList {
diff --git a/test/mailbox.lm b/test/mailbox.lm
index 5724e156..29f88062 100644
--- a/test/mailbox.lm
+++ b/test/mailbox.lm
@@ -40,5 +40,5 @@ def message
def start
[message*]
-start S = parse start( stdin )
+S: start = parse start( stdin )
print_xml( S )
diff --git a/test/matchex.lm b/test/matchex.lm
index 67b69238..ed7e9f56 100644
--- a/test/matchex.lm
+++ b/test/matchex.lm
@@ -21,7 +21,7 @@ def item
[tag]
| [id]
-tag Tag = parse tag( stdin )
+Tag: tag = parse tag( stdin )
# Style: List of literal text and types.
match Tag ["<person name=" Val1:id attr*">" item* "</person>"]
diff --git a/test/maxlen.lm b/test/maxlen.lm
index 8dcfa028..7167ce58 100644
--- a/test/maxlen.lm
+++ b/test/maxlen.lm
@@ -15,14 +15,14 @@ lex start
token id /rl_id/
}
-global int num
-global int allow = 3
+global num: int
+global allow: int = 3
def item
[id]
{
num = num + 1
- int toomuch = allow+1
+ toomuch: int = allow+1
if num == toomuch {
reject
}
diff --git a/test/mutualrec.lm b/test/mutualrec.lm
index 1231d224..bfaf0d24 100644
--- a/test/mutualrec.lm
+++ b/test/mutualrec.lm
@@ -1,10 +1,10 @@
-int f1( int i )
+int f1( i: int )
{
return f2( i + 1 ) + 1
}
-int f2( int i )
+int f2( i: int )
{
if i < 10
return f1( i + 1 ) + 1
diff --git a/test/nestedcomm.lm b/test/nestedcomm.lm
index ab99bcba..3ea26e2c 100644
--- a/test/nestedcomm.lm
+++ b/test/nestedcomm.lm
@@ -36,7 +36,7 @@ def nested_comment
def nested [id*]
-nested P = parse nested( stdin )
+P: nested = parse nested( stdin )
print_xml( P )
print_xml_ac( P )
print( P, '\n' )
diff --git a/test/python/python.lm b/test/python/python.lm
index 05c07042..ad52ce63 100644
--- a/test/python/python.lm
+++ b/test/python/python.lm
@@ -3,11 +3,11 @@ rl ident_char /[a-zA-Z_]/
# List used as a stack of indentations.
list indent_stack [int]
-global indent_stack IndentStack = construct indent_stack []
+global IndentStack: indent_stack = construct indent_stack []
IndentStack.push( 0 )
# Has a newline been sent for this '\n' .. whitespace match.
-global int newline_sent = 0
+global newline_sent: int = 0
# Tokens.
lex start
@@ -102,7 +102,7 @@ lex start
input.push_ignore( make_token( typeid WS, input.pull(match_length) ) )
# We have already sent the newline, compute the indentation level.
- int data_length = match_length - 1
+ data_length: int = match_length - 1
if data_length > IndentStack.top {
# The indentation level is more than the level on the top
@@ -135,7 +135,7 @@ lex start
# Blank lines or comment lines at the beginning of the file.
token LEADER / ( [ \t]* ('#' [^\n]*)? '\n' )* /
-int print_target_subscriptions_and_slicings( start Start )
+int print_target_subscriptions_and_slicings( Start: start )
{
for TI: target_ext in Start {
if match TI [subscription] {
@@ -153,9 +153,9 @@ int print_target_subscriptions_and_slicings( start Start )
}
-int print_primary_subscriptions_and_slicings( start Start )
+int print_primary_subscriptions_and_slicings( Start: start )
{
- for PI:primary_ext in Start {
+ for PI: primary_ext in Start {
if match PI [subscription] {
print( 'PRIMARY SUBSCRIPTION: ', PI, '\n' )
}
@@ -719,13 +719,13 @@ def keyword_arguments
def keyword_item
[identifier '=' expression]
-int print_stmts( start S )
+int print_stmts( S: start )
{
for Stmt: statement in S
print( 'STMT: ', Stmt, '\n' )
}
-start S = parse start( stdin )
+S: start = parse start( stdin )
print_xml( S )
print( S, '\n' )
print_stmts( S )
diff --git a/test/rediv.lm b/test/rediv.lm
index 3f63af75..cb78ce72 100644
--- a/test/rediv.lm
+++ b/test/rediv.lm
@@ -84,7 +84,7 @@ def start
[statement*]
-start S = parse start( stdin )
+S: start = parse start( stdin )
for I:orlit_item in S {
if match I [orlit_chr] {
diff --git a/test/reparse.lm b/test/reparse.lm
index dd7fff5b..340327c9 100644
--- a/test/reparse.lm
+++ b/test/reparse.lm
@@ -12,11 +12,11 @@ def item
def start
[item*]
-item* Input = parse item*( stdin )
+Input: item* = parse item*( stdin )
-start S = cons start[ Input ]
+S: start = cons start[ Input ]
-start Again = parse start( Input )
+Again: start = parse start( Input )
print( Again, '\n' )
diff --git a/test/repeat.lm b/test/repeat.lm
index 60d03f66..efde2957 100644
--- a/test/repeat.lm
+++ b/test/repeat.lm
@@ -12,7 +12,7 @@ def item
def start
[item*]
-start Input = parse start( stdin )
+Input: start = parse start( stdin )
match Input [ItemList: item*]
diff --git a/test/rubyhere.lm b/test/rubyhere.lm
index 799d96ed..7a39b96b 100644
--- a/test/rubyhere.lm
+++ b/test/rubyhere.lm
@@ -9,7 +9,7 @@ lex start
literal '<<', '*', ',', '(', ')', '!'
}
-global str HereId
+global HereId: str
token rest_of_line /[^\n]*'\n'/
@@ -17,17 +17,17 @@ lex here_start
{
ignore /[ \t\n]+/
token here_id
- here_data HereData
+ HereData: here_data
/ident_pattern/
{
# Take the text of the here_id from the input stream.
HereId = input.pull( match_length )
# Get the data up to the rest of the line.
- rest_of_line ROL = parse_stop rest_of_line( stdin )
+ ROL: rest_of_line = parse_stop rest_of_line( stdin )
# Parse the heredoc data.
- here_data HereData = parse_stop here_data( stdin )
+ HereData: here_data HereData = parse_stop here_data( stdin )
# Push the rest-of-line data back to the input stream.
input.push( $ROL )
@@ -88,5 +88,5 @@ def item
def start
[item*]
-start S = parse start( stdin )
+S: start = parse start( stdin )
print_xml(S)
diff --git a/test/scope1.lm b/test/scope1.lm
index d82abee9..8d104fa4 100644
--- a/test/scope1.lm
+++ b/test/scope1.lm
@@ -1,17 +1,17 @@
int f()
{
- int i = 0
- int j = 100
+ i: int = 0
+ j: int = 100
while i < 4 {
- int j = 200
+ j: int = 200
if ( i < 1 ) {
- int j = 300
+ j: int = 300
print( "i: [$i] j: [$j]\n" )
}
elsif ( i < 2 ) {
- int j = 300
+ j: int = 300
print( "i: [$i] j: [$j]\n" )
}
elsif ( i < 3 ) {
diff --git a/test/string.lm b/test/string.lm
index 7da88215..1d437588 100644
--- a/test/string.lm
+++ b/test/string.lm
@@ -50,5 +50,5 @@ def start
}
}
-start S = parse start(stdin)
+S: start = parse start(stdin)
print_xml( S )
diff --git a/test/superid.lm b/test/superid.lm
index b7d3fec7..2dbb1bde 100644
--- a/test/superid.lm
+++ b/test/superid.lm
@@ -14,7 +14,7 @@ lex start
ignore ws / [ \n\t]+ /
}
-global int trans_id_to
+global trans_id_to: int
def e1
[]
@@ -25,7 +25,7 @@ def e1
}
def item1
- str msg
+ msg: str
[ e1 '!' 'a' super_id super_id 'a']
{
@@ -41,7 +41,7 @@ def e2
}
def item2
- str msg
+ msg: str
[ e2 '!' 'a' super_id super_id 'a']
{
diff --git a/test/tags.lm b/test/tags.lm
index 89f7301b..1dcf387d 100644
--- a/test/tags.lm
+++ b/test/tags.lm
@@ -32,7 +32,7 @@ def tag_stack
[id tag_stack]
| []
-global tag_stack TS = construct tag_stack ["sentinal"]
+global TS: tag_stack = construct tag_stack ["sentinal"]
#
# Productions
@@ -53,8 +53,8 @@ def open_tag
def close_tag
[id]
{
- match lhs [Id:id]
- match TS [Top:id Rest:tag_stack]
+ match lhs [Id: id]
+ match TS [Top: id Rest: tag_stack]
if Id.data == Top.data
TS = construct tag_stack [Rest]
diff --git a/test/til.lm b/test/til.lm
index 24acd4e3..b2f63a9f 100644
--- a/test/til.lm
+++ b/test/til.lm
@@ -87,7 +87,7 @@ def labelled_statement
def goto_statement
['goto' id ';']
-program P = parse program(stdin)
+P: program = parse program(stdin)
#for S:statement* in P
#{
@@ -126,8 +126,8 @@ for S: statement* in P
First: statement
Rest: statement*]
{
- expression Expr
- statement* Following
+ Expr: expression
+ Following: statement*
# Look though the remaining statements for a goto back to the label.
# The repeat iterator yields only top-level statement lists. It
diff --git a/test/translate1.lm b/test/translate1.lm
index 8775111f..a87b7583 100644
--- a/test/translate1.lm
+++ b/test/translate1.lm
@@ -4,7 +4,7 @@ lex start
literal '*', '(', ')'
token id /[a-zA-Z_]+/
{
- str t = input.pull( match_length )
+ t: str = input.pull( match_length )
input.push( make_token( typeid id, t ) )
}
}
@@ -19,6 +19,6 @@ def item
def start
[item*]
-start Input = parse start( stdin )
+Input: start = parse start( stdin )
print( Input, '\n' )
diff --git a/test/translate2.lm b/test/translate2.lm
index 16c54586..74c31874 100644
--- a/test/translate2.lm
+++ b/test/translate2.lm
@@ -48,7 +48,7 @@ context ctx
| [B item* ';\n']
}
-ctx CTX = cons ctx []
-ctx::start Input = parse ctx::start( CTX, stdin )
+CTX: ctx = cons ctx []
+Input: ctx::start = parse ctx::start( CTX, stdin )
print( Input )
diff --git a/test/travs1.lm b/test/travs1.lm
index c2e3cea6..d3e7bf6b 100644
--- a/test/travs1.lm
+++ b/test/travs1.lm
@@ -63,13 +63,13 @@ def factor
def alphabet_num
[uint]
-start S = parse start(stdin)
+S: start = parse start(stdin)
#
# Top-Down, Left-Right
#
-int do_topdown_leftright( ref any T )
+int do_topdown_leftright( T: ref any )
{
for C:any in child(T) {
yield C
@@ -77,7 +77,7 @@ int do_topdown_leftright( ref any T )
}
}
-iter topdown_leftright( ref any T )
+iter topdown_leftright( T: ref any )
{
do_topdown_leftright( T )
}
@@ -86,7 +86,7 @@ iter topdown_leftright( ref any T )
# Bottom-Up, Left-Right
#
-int do_bottomup_leftright( ref any T )
+int do_bottomup_leftright( T: ref any )
{
for C:any in child(T) {
do_bottomup_leftright( C )
@@ -94,7 +94,7 @@ int do_bottomup_leftright( ref any T )
}
}
-iter bottomup_leftright( ref any T )
+iter bottomup_leftright( T: ref any )
{
do_bottomup_leftright( T )
}
@@ -104,7 +104,7 @@ iter bottomup_leftright( ref any T )
# Top-Down, Right-Left
#
-int do_topdown_rightleft( ref any T )
+int do_topdown_rightleft( T: ref any )
{
for C:any in rev_child(T) {
yield C
@@ -112,7 +112,7 @@ int do_topdown_rightleft( ref any T )
}
}
-iter topdown_rightleft( ref any T )
+iter topdown_rightleft( T: ref any )
{
do_topdown_rightleft( T )
}
@@ -121,7 +121,7 @@ iter topdown_rightleft( ref any T )
# Bottom-Up, Right-Left
#
-int do_bottomup_rightleft( ref any T )
+int do_bottomup_rightleft( T: ref any )
{
for C:any in rev_child(T) {
do_bottomup_rightleft( C )
@@ -129,7 +129,7 @@ int do_bottomup_rightleft( ref any T )
}
}
-iter bottomup_rightleft( ref any T )
+iter bottomup_rightleft( T: ref any )
{
do_bottomup_rightleft( T )
}
diff --git a/test/treecmp1.lm b/test/treecmp1.lm
index 085d0d21..016beed3 100644
--- a/test/treecmp1.lm
+++ b/test/treecmp1.lm
@@ -11,8 +11,8 @@ lex start
def four_ids
[id id id id]
-id B = construct id "b"
-four_ids Input = parse four_ids( stdin )
+B: id = construct id "b"
+Input: four_ids = parse four_ids( stdin )
for Id: id in Input {
if ( Id == B )
diff --git a/test/undofrag1.lm b/test/undofrag1.lm
index 60166540..8821607d 100644
--- a/test/undofrag1.lm
+++ b/test/undofrag1.lm
@@ -13,7 +13,7 @@ def start2
[item2*]
parser start2_parser [start2]
-global start2_parser SP = cons start2_parser []
+global SP: start2_parser = cons start2_parser []
context ctx
{
@@ -47,8 +47,8 @@ context ctx
SP << "a b{c}"
-ctx CTX = cons ctx []
-ctx::start Input = parse ctx::start( CTX, stdin )
+CTX: ctx = cons ctx []
+Input: ctx::start = parse ctx::start( CTX, stdin )
SP << "{e}f g"
diff --git a/test/undofrag2.lm b/test/undofrag2.lm
index d5c51e7b..21943962 100644
--- a/test/undofrag2.lm
+++ b/test/undofrag2.lm
@@ -6,7 +6,7 @@ lex start
}
parser out_parser [out]
-global out_parser Out = construct out_parser []
+global Out: out_parser = construct out_parser []
def out_item
[id]
@@ -35,5 +35,5 @@ def start
[A1 item* '^']
| [A2 item* ';' '\n']
-start Input = parse start( stdin )
+Input: start = parse start( stdin )
print( Input )
diff --git a/test/undofrag3.lm b/test/undofrag3.lm
index cdb05cf1..0996e432 100644
--- a/test/undofrag3.lm
+++ b/test/undofrag3.lm
@@ -6,7 +6,7 @@ lex start
}
parser out_parser [out]
-global out_parser Out = construct out_parser []
+global Out: out_parser = construct out_parser []
def out_item
[id]
@@ -41,5 +41,5 @@ def start
[A1 item* F '.' '^']
| [A2 item* F '.' ';' '\n']
-start Input = parse start( stdin )
+Input: start = parse start( stdin )
print( Input )
diff --git a/test/xml/xml.lm b/test/xml/xml.lm
index 803d4a5d..d7e90771 100644
--- a/test/xml/xml.lm
+++ b/test/xml/xml.lm
@@ -150,7 +150,7 @@ def document
def start
[document]
-start S = parse start(stdin)
+S: start = parse start(stdin)
for Switch:tag in S {
if match Switch