Commits

Anonymous committed 6075012

Simplest packaged classes example works, but this construct has been broken: R ::= 1 (where R is a variable)

  • Participants
  • Parent commits 3085a1d
  • Branches packages

Comments (0)

Files changed (2)

Compiler/Front/parse.sa

    -- Gets class name with any prefixed packages
      class_name ::= "";
      loop
-       class_name := class_name + ident.str;
        if ~is_class_name_elt(ident) then
          exp_error("class name")
        end;
-       while!( check( colon_tok ));
+       class_name := class_name + ident.str;
+       colon ::= check( colon_tok );
+       --#OUT + "class name partial: " + class_name + ", colon " + colon + ", ident: " + ident.str + ", next: " + next.str + "\n";
+       while!( colon);
        class_name := class_name + ":";
        fetch;
-       #OUT + "next: " + ident.str + "\n";
+       --#OUT + "next: " + ident.str + "\n";
      end;
+     --#OUT + "returning class name : " + class_name + "\n";
+     return #(class_name);
    end;
 
    is_class_name_elt (x: IDENT): BOOL is
       res ::= #AS_TYPE_SPEC; res.source := source_loc;
       if check(SAME_tok) then res.kind := AS_TYPE_SPEC::same
       elsif (next = type_name_tok) or (next = ident_tok) then
+	 --#OUT + "next: " + next.str + ", ident: " + ident.str + "\n";
          if (next = ident_tok) and ~is_class_name_elt(ident) then
             error("class name must be all upper_case") end;
          res.kind := AS_TYPE_SPEC::ord;
-         res.name := ident; fetch;
+         --res.name := ident; 
+	 fetch;
+         res.name := qualified_class_name; 
+	 --#OUT + "----type spec: " + res.name.str + "\n";
          if check(lbrace_tok) then
             res.params := type_spec_list;
             match(rbrace_tok) end
    -- rout_or_iter_name => ident | [ident] '!'
    --
       res: IDENT;
-			#OUT + "ident: " + ident.str + "\n";
       if next = ident_tok then res := ident; fetch;
          if next = iter_bang_tok then fetch;
             res := append_bang(res)
    --
       res: AS_CALL_EXPR;
       enter("call expressions");
-			#OUT + "tp: " + tp.name.str + "\n";
+			--#OUT + "tp: " + tp.name.str + "\n";
       res := #AS_CALL_EXPR; res.source := source_loc; res.ob := ob; res.tp := tp;
       res.name := rout_or_iter_name;
-			#OUT + "rout_or_iter_name: " + res.name.str + "\n";
+			--#OUT + "rout_or_iter_name: " + res.name.str + "\n";
       if check(lparen_tok) then 
 	  -- always allow once? Check later? (Boris)
 	  t ::= mode_expr_list(underscore_args, res.name.is_iter); 
       if check(dot_tok) then -- expr0 '.'
          res := call_expr(res, void, underscore_args)
       elsif check(dcolon_tok) then -- type_spec '::'
-				#OUT + "call expr with dcolon\n";
-				-- TODO: extract full class name (with package)
+	-- TODO: extract full class name (with package)?
          res := call_expr(void, type_of(res), underscore_args);
       elsif check(iter_bang_tok) then -- part of call_expr: ident '!'
          c := #AS_CALL_EXPR; c.source := source_loc;

Library/Strings/base_format.sa

 	    yield 0
 	else
 	    -- Getting fractional representation of the floating point number.
-	    R ::= lshift( f, 0.max(e-p) ); -- Denominator
-	    S ::= lshift( one, 0.max(-(e-p)) ); -- Nominator
+	    r ::= lshift( f, 0.max(e-p) ); -- Denominator
+	    s ::= lshift( one, 0.max(-(e-p)) ); -- Nominator
 	    -- Error threshold for precision exhaustion.
 	    Mm ::= lshift( one, 0.max(e-p) );
 	    Mp ::= Mm;
 	    if f = lshift( one, p-1 ) then
 		-- Taking unequal gaps between numbers into account.
 		Mp := Mp * two;
-		R := R * two;
-		S := S * two;
+		r := r * two;
+		s := s * two;
 	    end;
 	    k := 0;
 	    loop
 		-- Subnormal numbers
-		while!( R < (S+nine) / ten );
+		while!( r < (s+nine) / ten );
 		k := k - 1;
-		R := R * ten;
+		r := r * ten;
 		Mm := Mm * ten;
 		Mp := Mp * ten;
 	    end;
 	    loop
 		loop
-		    while!( two * R + Mp >= two * S );
-		    S := S * ten;
+		    while!( two * r + Mp >= two * s );
+		    s := s * ten;
 		    k := k + 1;
 		end;
 		-- Adjustments to Mm and Mp for formatting requirements
 		    cutplace := k;
 		when co_abs then
 		    cutoffadj( inout Mm, inout Mp, inout roundup,
-			      S, k, cutplace );
+			      s, k, cutplace );
 		when co_rel then
 		    cutplace := k + cutplace;
 		    cutoffadj( inout Mm, inout Mp, inout roundup,
-			      S, k, cutplace );
+			      s, k, cutplace );
 		else
 		    raise "dragon4 error"
 		end;
-		while!( two * R + Mp >= two * S );
+		while!( two * r + Mp >= two * s );
 	    end;
 	    -- END FIXUP
 	    
 	    low,high: BOOL;
 	    loop
 		k := k - 1;
-		U := (( R * ten ) / S).int;
-		R := ( R * ten ) % S;
+		U := (( r * ten ) / s).int;
+		r := ( r * ten ) % s;
 		Mm := Mm * ten;
 		Mp := Mp * ten;
-		low := two * R < Mm;
+		low := two * r < Mm;
 		if roundup then
-		    high := two * R >= ( two * S ) - Mp
+		    high := two * r >= ( two * s ) - Mp
 		else
-		    high := two * R > ( two * S ) - Mp;
+		    high := two * r > ( two * s ) - Mp;
 		end;
 		while!( ~low and ~high and k /= cutplace );
 		yield U
 	    elsif high and ~low then
 		yield U+1
 	    else
-		if two * R <= S then
+		if two * r <= s then
 		    yield U;
 		else
 		    yield U+1;
     end; -- dragon4
 
     private cutoffadj( inout Mm: INTI, inout Mp: INTI, inout roundup: BOOL,
-		      S: INTI, k: INT, cutplace: INT )
+		      s: INTI, k: INT, cutplace: INT )
     -- Recomputing the accuracy thresholds to ensure correct rounding
     -- even when not comptuing to maximal floating point accuracy.
     is
 	a: INT; -- (negated) Number of digits to print.
 	a := cutplace-k;
-	y ::= S;
+	y ::= s;
 	if a >= 0 then
 	    loop j ::= 1.upto!(a); y := y * ten; end;
 	else