shithub: mc

Download patch

ref: 969945de572d39acd871f2d9371ea81b841c538a
parent: 78feb233b1899dd458a1f43965e842cdd6822346
author: Michael Forney <mforney@mforney.org>
date: Fri Jun 23 21:11:30 EDT 2017

Miscellaneous typo/formatting fixes

--- a/6/simp.c
+++ b/6/simp.c
@@ -988,7 +988,7 @@
 	Type *ft;
 	Op op;
 
-	/* NB: If we called rval() on a const function, , we would end up with
+	/* NB: If we called rval() on a const function, we would end up with
 	   a stack allocated closure. We don't want to do this. */
 	fn = n->expr.args[0];
 	if (!isconstfn(fn))
--- a/doc/lang.txt
+++ b/doc/lang.txt
@@ -124,15 +124,15 @@
         manual.
 
             $noret          _               break
-            castto          const           continue
-            elif            else            extern
-            false           for             generic
-            goto            if              impl
-            in              match           pkg
-            pkglocal        sizeof          struct
-            trait           true            type
-            union           use             var
-            void            while
+            const           continue        elif
+            else            extern          false
+            for             generic         goto
+            if              impl            in
+            match           pkg             pkglocal
+            sizeof          struct          trait
+            true            type            union
+            use             var             void
+            while
 
         Literals are a direct representation of a data object within the
         source of the program. There are several literals implemented within
@@ -271,9 +271,9 @@
     3.4. Packages and Uses
 
             package:        "pkg" ident = decl* ";;"
-            use:        bareuse | quoteuse
+            use:            bareuse | quoteuse
             bareuse:        use ident
-            quoteuse:        use "<quoted string>"
+            quoteuse:       use "<quoted string>"
 
 
         There are two keywords for module system. 'use' is the simpler
@@ -392,7 +392,7 @@
 
         primitivetype:      misctype | inttype | flttype
         misctype:           "void"  | "bool" | "char" | "byte"
-        inttype:             "int8" |  "uint8" |
+        inttype:            "int8"  |  "uint8" |
                             "int16" | "uint16" |
                             "int32" | "uint32" |
                             "int64" | "uint64" |
@@ -445,7 +445,7 @@
             If the array size is specified as "...", then the array has zero bytes
             allocated to store it, and bounds are not checked. This allows
             flexible arrays. Flexible arrays are arrays defined at the end of
-            a struct, which do not contrbute to the size of the array. When
+            a struct, which do not contribute to the size of the struct. When
             allocating a struct on the heap, extra space may be reserved for
             the array, allowing variable sizes of trailing data. This is not
             used commonly, but turns out to be useful for C ABI comatibility.
@@ -582,7 +582,7 @@
             specialized. For example:
 
                 trait gettable @container -> @contained =
-                    const get : (c : @container -> @contained)
+                    get : (c : @container -> @contained)
                 ;;
 
             would define a trait that requires a get function which accepts
@@ -1107,8 +1107,8 @@
 
         5.2.1. Summary and Precedence:
 
-                expr:                expr <binop> expr | prefixexpr | postfixexpr
-                postfixexpr:        <prefixop> postfixexpr
+                expr:              expr <binop> expr | prefixexpr | postfixexpr
+                postfixexpr:       <prefixop> postfixexpr
                 prefixexpr:        atomicexpr <unaryop>
 
             Myrddin expressions should be fairly familiar to most programmers.
@@ -1144,7 +1144,7 @@
                     x#              Dereference
                     x[e]            Index
                     x[lo:hi]        Slice
-                    x(arg,list)        Call
+                    x(arg,list)     Call
 
             Precedence 10:
                     &x              Address
@@ -1953,7 +1953,7 @@
     pkgbody:   (decl | attrs tydef | traitdef | impldef)*
 
     /* declarations */
-    decl:       attrs ("var" | "const") decllist
+    decl:       attrs ("var" | "const" | "generic") decllist
     attrs:      ("$noret" | "extern" | "pkglocal")*
     decllist:   declbody ("," declbody)+
     declbody:   declcore ["=" expr]
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -2,7 +2,7 @@
 typedef struct Bb Bb;
 typedef struct Reaching Reaching;
 
-struct  Cfg {
+struct Cfg {
 	Node *fn;
 	Bb **bb;
 	Bb *start;
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -110,7 +110,7 @@
 
 %token<tok> Tconst	/* const */
 %token<tok> Tvar	/* var */
-%token<tok> Tgeneric	/* var */
+%token<tok> Tgeneric	/* generic */
 
 %token<tok> Tgap	/* _ */
 %token<tok> Tellipsis	/* ... */
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -921,7 +921,7 @@
 	if (a->asize && exprop(a->asize) != Olit)
 		lfatal(ctx->loc, "%s: array size is not constant near %s",
 				tystr(a), ctxstr(st, ctx));
-	if (a->asize && exprop(b->asize) != Olit)
+	if (b->asize && exprop(b->asize) != Olit)
 		lfatal(ctx->loc, "%s: array size is not constant near %s",
 				tystr(b), ctxstr(st, ctx));
 	if (!a->asize)
@@ -1538,11 +1538,11 @@
 		infersub(st, n, ret, sawret, &isconst);
 		settype(st, n, mktylike(n->loc, Tyuint));
 		break;
-	case Ocall: /* (@a, @b, @c, ... -> @r)(@a,@b,@c, ... -> @r) -> @r */
+	case Ocall: /* (@a, @b, @c, ... -> @r)(@a, @b, @c, ...) -> @r */
 		infersub(st, n, ret, sawret, &isconst);
 		unifycall(st, n);
 		break;
-	case Ocast: /* cast(@a, @b) -> @b */
+	case Ocast: /* (@a : @b) -> @b */
 		infersub(st, n, ret, sawret, &isconst);
 		delayedcheck(st, n, curstab());
 		break;
--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -598,7 +598,7 @@
 	if (gnode->decl.trait) {
 		g = bestimpl(gnode, to);
 		if (!g)
-			fatal(gnode, "no trait implemented for for %s:%s", namestr(gnode->decl.name), tystr(to));
+			fatal(gnode, "no trait implemented for %s:%s", namestr(gnode->decl.name), tystr(to));
 	} else {
 		g = gnode;
 	}