Commit 21e2e60d authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur 🏢
Browse files

changed some names to properly reflect their type

parent 9f3de778
...@@ -300,7 +300,7 @@ where ...@@ -300,7 +300,7 @@ where
initModule :: String String ScanState !*HashTable !*File *Files initModule :: String String ScanState !*HashTable !*File *Files
-> (!Bool, !ParsedModule, !*HashTable, !*File, !*Files) -> (!Bool, !ParsedModule, !*HashTable, !*File, !*Files)
initModule file_name modification_time scanState hash_table error files initModule file_name modification_time scanState hash_table error files
# (succ, mod_type, mod_ident, scanState) = try_module_header iclmodule scanState # (succ, mod_type, mod_name, scanState) = try_module_header iclmodule scanState
| succ | succ
# pState = { ps_scanState = scanState # pState = { ps_scanState = scanState
, ps_error = { pea_file = error, pea_ok = True } , ps_error = { pea_file = error, pea_ok = True }
...@@ -308,8 +308,8 @@ where ...@@ -308,8 +308,8 @@ where
, ps_hash_table = hash_table , ps_hash_table = hash_table
, ps_support_generics = support_generics , ps_support_generics = support_generics
} }
pState = verify_name mod_ident id_name file_name pState pState = verify_name mod_name id_name file_name pState
(mod_ident, pState) = stringToIdent mod_ident IC_Module pState (mod_ident, pState) = stringToIdent mod_name IC_Module pState
pState = check_layout_rule pState pState = check_layout_rule pState
(defs, pState) = want_definitions (SetGlobalContext iclmodule) pState (defs, pState) = want_definitions (SetGlobalContext iclmodule) pState
{ps_scanState,ps_hash_table,ps_error} {ps_scanState,ps_hash_table,ps_error}
...@@ -1068,8 +1068,8 @@ wantImports pState ...@@ -1068,8 +1068,8 @@ wantImports pState
wantFromImports :: !ParseState -> (!ParsedImport, !ParseState) wantFromImports :: !ParseState -> (!ParsedImport, !ParseState)
wantFromImports pState wantFromImports pState
# (mod_ident, pState) = wantModuleName pState # (mod_name, pState) = wantModuleName pState
(mod_ident, pState) = stringToIdent mod_ident IC_Module pState (mod_ident, pState) = stringToIdent mod_name IC_Module pState
pState = wantToken GeneralContext "from imports" ImportToken pState pState = wantToken GeneralContext "from imports" ImportToken pState
(file_name, line_nr, pState) = getFileAndLineNr pState (file_name, line_nr, pState) = getFileAndLineNr pState
(import_symbols, pState) = wantSequence CommaToken GeneralContext pState (import_symbols, pState) = wantSequence CommaToken GeneralContext pState
...@@ -1139,12 +1139,12 @@ want_2_0_import_declaration token pState ...@@ -1139,12 +1139,12 @@ want_2_0_import_declaration token pState
-> (ID_Class { ii_ident = class_id, ii_extended = ii_extended } (Yes members), pState) -> (ID_Class { ii_ident = class_id, ii_extended = ii_extended } (Yes members), pState)
-> (ID_Class { ii_ident = class_id, ii_extended = ii_extended } No, tokenBack pState) -> (ID_Class { ii_ident = class_id, ii_extended = ii_extended } No, tokenBack pState)
InstanceToken InstanceToken
# (class_ident, pState) = want pState # (class_name, pState) = want pState
// (ii_extended, pState) = optional_extension pState // MW: removed but still not ok // (ii_extended, pState) = optional_extension pState // MW: removed but still not ok
ii_extended = False ii_extended = False
(types, pState) = wantList "instance types" tryBrackType pState (types, pState) = wantList "instance types" tryBrackType pState
(class_id, pState) = stringToIdent class_ident IC_Class pState (class_id, pState) = stringToIdent class_name IC_Class pState
(inst_id, pState) = stringToIdent class_ident (IC_Instance types) pState (inst_id, pState) = stringToIdent class_name (IC_Instance types) pState
(context, pState) = optionalContext pState (context, pState) = optionalContext pState
-> (ID_Instance { ii_ident = class_id, ii_extended = ii_extended } inst_id (types,context), pState) -> (ID_Instance { ii_ident = class_id, ii_extended = ii_extended } inst_id (types,context), pState)
IdentToken fun_name IdentToken fun_name
...@@ -1306,10 +1306,10 @@ wantClassDefinition parseContext pos pState ...@@ -1306,10 +1306,10 @@ wantClassDefinition parseContext pos pState
wantInstanceDeclaration :: !ParseContext !Position !ParseState -> (!ParsedDefinition, !ParseState) wantInstanceDeclaration :: !ParseContext !Position !ParseState -> (!ParsedDefinition, !ParseState)
wantInstanceDeclaration parseContext pi_pos pState wantInstanceDeclaration parseContext pi_pos pState
# (class_ident, pState) = want pState # (class_name, pState) = want pState
(pi_class, pState) = stringToIdent class_ident IC_Class pState (pi_class, pState) = stringToIdent class_name IC_Class pState
((pi_types, pi_context), pState) = want_instance_type pState ((pi_types, pi_context), pState) = want_instance_type pState
(pi_ident, pState) = stringToIdent class_ident (IC_Instance pi_types) pState (pi_ident, pState) = stringToIdent class_name (IC_Instance pi_types) pState
// AA.. // AA..
# (token, pState) = nextToken TypeContext pState # (token, pState) = nextToken TypeContext pState
/* /*
...@@ -1329,7 +1329,7 @@ wantInstanceDeclaration parseContext pi_pos pState ...@@ -1329,7 +1329,7 @@ wantInstanceDeclaration parseContext pi_pos pState
// otherwise // ~ (isIclContext parseContext) // otherwise // ~ (isIclContext parseContext)
| token == CommaToken | token == CommaToken
# (pi_types_and_contexts, pState) = want_instance_types pState # (pi_types_and_contexts, pState) = want_instance_types pState
(idents, pState) = seqList [stringToIdent class_ident (IC_Instance type) \\ (type,context) <- pi_types_and_contexts] pState (idents, pState) = seqList [stringToIdent class_name (IC_Instance type) \\ (type,context) <- pi_types_and_contexts] pState
= (PD_Instances = (PD_Instances
// [ { pi_class = pi_class, pi_ident = pi_ident, pi_types = type, pi_context = context // voor martin // [ { pi_class = pi_class, pi_ident = pi_ident, pi_types = type, pi_context = context // voor martin
[ { pi_class = pi_class, pi_ident = ident, pi_types = type, pi_context = context [ { pi_class = pi_class, pi_ident = ident, pi_types = type, pi_context = context
...@@ -1476,13 +1476,13 @@ optionalCoercions pState ...@@ -1476,13 +1476,13 @@ optionalCoercions pState
# (more_inequals, pState) = want_inequalities pState # (more_inequals, pState) = want_inequalities pState
= (inequals ++ more_inequals, pState) = (inequals ++ more_inequals, pState)
= (inequals, tokenBack pState) = (inequals, tokenBack pState)
want_attr_inequality (IdentToken var_ident) pState want_attr_inequality (IdentToken var_name) pState
| isLowerCaseName var_ident | isLowerCaseName var_name
# (off_ident, pState) = stringToIdent var_ident IC_TypeAttr pState # (off_ident, pState) = stringToIdent var_name IC_TypeAttr pState
(token, pState) = nextToken TypeContext pState (token, pState) = nextToken TypeContext pState
| token == LessThanOrEqualToken | token == LessThanOrEqualToken
# (var_ident, pState) = wantLowerCaseName "attribute inequality" pState # (var_name, pState) = wantLowerCaseName "attribute inequality" pState
(dem_ident, pState) = stringToIdent var_ident IC_TypeAttr pState (dem_ident, pState) = stringToIdent var_name IC_TypeAttr pState
ai_demanded = makeAttributeVar dem_ident ai_demanded = makeAttributeVar dem_ident
= (ai_demanded, [{ ai_demanded = ai_demanded, ai_offered = makeAttributeVar off_ident }], pState) = (ai_demanded, [{ ai_demanded = ai_demanded, ai_offered = makeAttributeVar off_ident }], pState)
# (ai_demanded, inequals, pState) = want_attr_inequality token pState # (ai_demanded, inequals, pState) = want_attr_inequality token pState
...@@ -1860,11 +1860,11 @@ optionalAnnotAndAttrWithPosition pState ...@@ -1860,11 +1860,11 @@ optionalAnnotAndAttrWithPosition pState
tryAttribute :: !Token !ParseState -> (!Bool, !TypeAttribute, !ParseState) tryAttribute :: !Token !ParseState -> (!Bool, !TypeAttribute, !ParseState)
tryAttribute DotToken pState = (True, TA_Anonymous, pState) tryAttribute DotToken pState = (True, TA_Anonymous, pState)
tryAttribute AsteriskToken pState = (True, TA_Unique, pState) tryAttribute AsteriskToken pState = (True, TA_Unique, pState)
tryAttribute (IdentToken id) pState tryAttribute (IdentToken name) pState
| isLowerCaseName id | isLowerCaseName name
# (token, pState) = nextToken TypeContext pState # (token, pState) = nextToken TypeContext pState
| ColonToken == token | ColonToken == token
# (ident, pState) = stringToIdent id IC_TypeAttr pState # (ident, pState) = stringToIdent name IC_TypeAttr pState
= (True, TA_Var (makeAttributeVar ident), pState) = (True, TA_Var (makeAttributeVar ident), pState)
= (False, TA_None, tokenBack (tokenBack pState)) = (False, TA_None, tokenBack (tokenBack pState))
tryAttribute _ pState = (False, TA_None, tokenBack pState) tryAttribute _ pState = (False, TA_None, tokenBack pState)
...@@ -2573,9 +2573,9 @@ wantLhsExpressionT2 (IdentToken name) pState /* to make a=:C x equivalent to a=: ...@@ -2573,9 +2573,9 @@ wantLhsExpressionT2 (IdentToken name) pState /* to make a=:C x equivalent to a=:
| token == DefinesColonToken | token == DefinesColonToken
# (token, pState) = nextToken FunctionContext pState # (token, pState) = nextToken FunctionContext pState
= case token of = case token of
IdentToken ident IdentToken name
| ~ (isLowerCaseName ident) | ~ (isLowerCaseName name)
# (constructor, pState) = stringToIdent ident IC_Expression pState # (constructor, pState) = stringToIdent name IC_Expression pState
(args, pState) = parseList trySimpleLhsExpression pState (args, pState) = parseList trySimpleLhsExpression pState
-> (PE_Bound { bind_dst = id, bind_src = combineExpressions (PE_Ident constructor) args }, pState) -> (PE_Bound { bind_dst = id, bind_src = combineExpressions (PE_Ident constructor) args }, pState)
_ # (succ, expr, pState) = trySimpleLhsExpressionT token pState _ # (succ, expr, pState) = trySimpleLhsExpressionT token pState
...@@ -2617,7 +2617,7 @@ trySimpleLhsExpressionT :: !Token !ParseState -> (!Bool, !ParsedExpr, !ParseSta ...@@ -2617,7 +2617,7 @@ trySimpleLhsExpressionT :: !Token !ParseState -> (!Bool, !ParsedExpr, !ParseSta
trySimpleLhsExpressionT token pState trySimpleLhsExpressionT token pState
# (succ, expr, pState) = trySimpleExpressionT token cIsAPattern pState # (succ, expr, pState) = trySimpleExpressionT token cIsAPattern pState
| succ | succ
# (token, pState) = nextToken FunctionContext pStates # (token, pState) = nextToken FunctionContext pState
= (True, expr, tokenBack pState) = (True, expr, tokenBack pState)
= (False, PE_Empty, pState) = (False, PE_Empty, pState)
...@@ -2679,8 +2679,8 @@ where ...@@ -2679,8 +2679,8 @@ where
want_selector (IdentToken name) pState want_selector (IdentToken name) pState
| isUpperCaseName name | isUpperCaseName name
# (field, pState) = want (wantToken FunctionContext "array selector" DotToken pState) # (field_name, pState) = want (wantToken FunctionContext "array selector" DotToken pState)
(field_id, pState) = stringToIdent field IC_Selector pState (field_id, pState) = stringToIdent field_name IC_Selector pState
(type_id, pState) = stringToIdent name IC_Type pState (type_id, pState) = stringToIdent name IC_Type pState
= ([PS_Record field_id (Yes type_id)], pState) = ([PS_Record field_id (Yes type_id)], pState)
# (field_id, pState) = stringToIdent name IC_Selector pState # (field_id, pState) = stringToIdent name IC_Selector pState
...@@ -3305,10 +3305,10 @@ where ...@@ -3305,10 +3305,10 @@ where
want_array_elems token pState want_array_elems token pState
= ([], parseError "array elements" (Yes token) "<array denotation>" pState) = ([], parseError "array elements" (Yes token) "<array denotation>" pState)
want_record_pattern (IdentToken ident) pState want_record_pattern (IdentToken name) pState
| isUpperCaseName ident | isUpperCaseName name
# pState = wantToken FunctionContext "record pattern" BarToken pState # pState = wantToken FunctionContext "record pattern" BarToken pState
(type_id, pState) = stringToIdent ident IC_Type pState (type_id, pState) = stringToIdent name IC_Type pState
(token, pState) = nextToken FunctionContext pState (token, pState) = nextToken FunctionContext pState
(fields, pState) = want_field_assignments cIsAPattern token pState (fields, pState) = want_field_assignments cIsAPattern token pState
= (PE_Record PE_Empty (Yes type_id) fields, wantToken FunctionContext "record pattern" CurlyCloseToken pState) = (PE_Record PE_Empty (Yes type_id) fields, wantToken FunctionContext "record pattern" CurlyCloseToken pState)
...@@ -3316,11 +3316,11 @@ where ...@@ -3316,11 +3316,11 @@ where
# (fields, pState) = want_field_assignments cIsAPattern token pState # (fields, pState) = want_field_assignments cIsAPattern token pState
= (PE_Record PE_Empty No fields, wantToken FunctionContext "record pattern" CurlyCloseToken pState) = (PE_Record PE_Empty No fields, wantToken FunctionContext "record pattern" CurlyCloseToken pState)
try_type_specification (IdentToken ident) pState try_type_specification (IdentToken type_name) pState
| isUpperCaseName ident || isFunnyIdName ident | isUpperCaseName type_name || isFunnyIdName type_name
# (token, pState) = nextToken FunctionContext pState # (token, pState) = nextToken FunctionContext pState
| token == BarToken | token == BarToken
# (type_id, pState) = stringToIdent ident IC_Type pState # (type_id, pState) = stringToIdent type_name IC_Type pState
= (Yes type_id, pState) = (Yes type_id, pState)
= (No, tokenBack pState) = (No, tokenBack pState)
= (No, pState) = (No, pState)
...@@ -3514,8 +3514,8 @@ where ...@@ -3514,8 +3514,8 @@ where
= ([ field : fields ], pState) = ([ field : fields ], pState)
= ([ field ], tokenBack pState) = ([ field ], tokenBack pState)
where where
want_field_expression is_pattern ident pState want_field_expression is_pattern field_name pState
# (field_id, pState) = stringToIdent ident IC_Selector pState # (field_id, pState) = stringToIdent field_name IC_Selector pState
(token, pState) = nextToken FunctionContext pState (token, pState) = nextToken FunctionContext pState
| token == EqualToken | token == EqualToken
# (field_expr, pState) = wantExpression is_pattern pState # (field_expr, pState) = wantExpression is_pattern pState
...@@ -3524,12 +3524,12 @@ where ...@@ -3524,12 +3524,12 @@ where
want_field_assignments is_pattern token pState want_field_assignments is_pattern token pState
= ([], parseError "record or array field assignments" (Yes token) "field name" pState) = ([], parseError "record or array field assignments" (Yes token) "field name" pState)
try_field_assignment (IdentToken ident) pState try_field_assignment (IdentToken field_name) pState
| isLowerCaseName ident | isLowerCaseName field_name
# (token, pState) = nextToken FunctionContext pState # (token, pState) = nextToken FunctionContext pState
| token == EqualToken | token == EqualToken
# (field_expr, pState) = wantExpression cIsNotAPattern pState # (field_expr, pState) = wantExpression cIsNotAPattern pState
(field_id, pState) = stringToIdent ident IC_Selector pState (field_id, pState) = stringToIdent field_name IC_Selector pState
= (True, { bind_src = field_expr, bind_dst = field_id}, pState) = (True, { bind_src = field_expr, bind_dst = field_id}, pState)
= (False, abort "no field", tokenBack pState) = (False, abort "no field", tokenBack pState)
= (False, abort "no field", pState) = (False, abort "no field", pState)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment