Align it to column 7 and it looks like all the code I saw when I started. 

iPhone email

> On Nov 25, 2015, at 12:13 PM, Ryan Gonzalez <rym...@gmail.com> wrote:
> 
> Neither! It's what happens when you run sed 's/^\s*//' on your whole code 
> base, yielding results like (from cmd/yacc.c):
> 
> 
> void
> setup(int argc, char *argv[])
> {
> long c, t;
> int i, j, fd, lev, ty, ytab, *p;
> int vflag, dflag, stem;
> char actnm[8], *stemc, *s, dirbuf[128];
> Biobuf *fout;
> 
> ytab = 0;
> vflag = 0;
> dflag = 0;
> stem = 0;
> stemc = "y";
> foutput = 0;
> fdefine = 0;
> fdebug = 0;
> ARGBEGIN{
> case 'v':
> case 'V':
> vflag++;
> break;
> case 'D':
> yydebug = ARGF();
> break;
> case 'a':
> yyarg = 1;
> break;
> case 'd':
> dflag++;
> break;
> case 'l':
> yyline = 0;
> break;
> case 'o':
> ytab++;
> ytabc = ARGF();
> break;
> case 's':
> stem++;
> stemc = ARGF();
> break;
> case 'S':
> parser = PARSERS;
> break;
> default:
> error("illegal option: %c", ARGC());
> }ARGEND
> openup(stemc, dflag, vflag, ytab, ytabc);
> fout = dflag?fdefine:ftable;
> if(yyarg){
> Bprint(ftable, "#define\tYYARG\t1\n\n");
> }
> if((fd = mkstemp(ttempname)) >= 0){
> tempname = ttempname;
> ftemp = Bfdopen(fd, OWRITE);
> }
> if((fd = mkstemp(tactname)) >= 0){
> actname = tactname;
> faction = Bfdopen(fd, OWRITE);
> }
> if(ftemp == 0 || faction == 0)
> error("cannot open temp file");
> if(argc < 1)
> error("no input file");
> infile = argv[0];
> if(infile[0] != '/' && getwd(dirbuf, sizeof dirbuf)!=nil){
> i = strlen(infile)+1+strlen(dirbuf)+1+10;
> s = malloc(i);
> if(s != nil){
> snprint(s, i, "%s/%s", dirbuf, infile);
> cleanname(s);
> infile = s;
> }
> }
> finput = Bopen(infile, OREAD);
> if(finput == 0)
> error("cannot open '%s'", argv[0]);
> cnamp = cnames;
> 
> defin(0, "$end");
> extval = PRIVATE;     /* tokens start in unicode 'private use' */
> defin(0, "error");
> defin(1, "$accept");
> defin(0, "$unk");
> mem = mem0;
> i = 0;
> 
> for(t = gettok(); t != MARK && t != ENDFILE;)
> switch(t) {
> case ';':
> t = gettok();
> break;
> 
> case START:
> if(gettok() != IDENTIFIER)
> error("bad %%start construction");
> start = chfind(1, tokname);
> t = gettok();
> continue;
> 
> case TYPEDEF:
> if(gettok() != TYPENAME)
> error("bad syntax in %%type");
> ty = numbval;
> for(;;) {
> t = gettok();
> switch(t) {
> case IDENTIFIER:
> if((t=chfind(1, tokname)) < NTBASE) {
> j = TYPE(toklev[t]);
> if(j != 0 && j != ty)
> error("type redeclaration of token %s",
> tokset[t].name);
> else
> SETTYPE(toklev[t], ty);
> } else {
> j = nontrst[t-NTBASE].value;
> if(j != 0 && j != ty)
> error("type redeclaration of nonterminal %s",
> nontrst[t-NTBASE].name );
> else
> nontrst[t-NTBASE].value = ty;
> }
> case ',':
> continue;
> case ';':
> t = gettok();
> default:
> break;
> }
> break;
> }
> continue;
> 
> case UNION:
> /* copy the union declaration to the output */
> cpyunion();
> t = gettok();
> continue;
> 
> case LEFT:
> case BINARY:
> case RIGHT:
> i++;
> 
> case TERM:
> /* nonzero means new prec. and assoc. */
> lev = t-TERM;
> ty = 0;
> 
> /* get identifiers so defined */
> t = gettok();
> 
> /* there is a type defined */
> if(t == TYPENAME) {
> ty = numbval;
> t = gettok();
> }
> for(;;) {
> switch(t) {
> case ',':
> t = gettok();
> continue;
> 
> case ';':
> break;
> 
> case IDENTIFIER:
> j = chfind(0, tokname);
> if(j >= NTBASE)
> error("%s defined earlier as nonterminal", tokname);
> if(lev) {
> if(ASSOC(toklev[j]))
> error("redeclaration of precedence of %s", tokname);
> SETASC(toklev[j], lev);
> SETPLEV(toklev[j], i);
> }
> if(ty) {
> if(TYPE(toklev[j]))
> error("redeclaration of type of %s", tokname);
> SETTYPE(toklev[j],ty);
> }
> t = gettok();
> if(t == NUMBER) {
> tokset[j].value = numbval;
> if(j < ndefout && j > 3)
> error("please define type number of %s earlier",
> tokset[j].name);
> t = gettok();
> }
> continue;
> }
> break;
> }
> continue;
> 
> case LCURLY:
> defout(0);
> cpycode();
> t = gettok();
> continue;
> 
> default:
> error("syntax error");
> }
> if(t == ENDFILE)
> error("unexpected EOF before %%");
> 
> /* t is MARK */
> if(!yyarg)
> Bprint(ftable, "extern        int     yyerrflag;\n");
> Bprint(ftable, "#ifndef       YYMAXDEPTH\n");
> Bprint(ftable, "#define       YYMAXDEPTH      150\n");
> Bprint(ftable, "#endif\n" );
> if(!ntypes) {
> Bprint(ftable, "#ifndef       YYSTYPE\n");
> Bprint(ftable, "#define       YYSTYPE int\n");
> Bprint(ftable, "#endif\n");
> }
> if(!yyarg){
> Bprint(ftable, "YYSTYPE       yylval;\n");
> Bprint(ftable, "YYSTYPE       yyval;\n");
> }else{
> if(dflag)
> Bprint(ftable, "#include \"%s.%s\"\n\n", stemc, FILED);
> Bprint(fout, "struct Yyarg {\n");
> Bprint(fout, "\tint\tyynerrs;\n");
> Bprint(fout, "\tint\tyyerrflag;\n");
> Bprint(fout, "\tvoid*\targ;\n");
> Bprint(fout, "\tYYSTYPE\tyyval;\n");
> Bprint(fout, "\tYYSTYPE\tyylval;\n");
> Bprint(fout, "};\n\n");
> }
> prdptr[0] = mem;
> 
> /* added production */
> *mem++ = NTBASE;
> 
> /* if start is 0, we will overwrite with the lhs of the first rule */
> *mem++ = start;
> *mem++ = 1;
> *mem++ = 0;
> prdptr[1] = mem;
> while((t=gettok()) == LCURLY)
> cpycode();
> if(t != IDENTCOLON)
> error("bad syntax on first rule");
> 
> if(!start)
> prdptr[0][1] = chfind(1, tokname);
> 
> /* read rules */
> while(t != MARK && t != ENDFILE) {
> /* process a rule */
> rlines[nprod] = lineno;
> if(t == '|')
> *mem++ = *prdptr[nprod-1];
> else
> if(t == IDENTCOLON) {
> *mem = chfind(1, tokname);
> if(*mem < NTBASE)
> error("token illegal on LHS of grammar rule");
> mem++;
> } else
> error("illegal rule: missing semicolon or | ?");
> /* read rule body */
> t = gettok();
> 
> more_rule:
> while(t == IDENTIFIER) {
> *mem = chfind(1, tokname);
> if(*mem < NTBASE)
> levprd[nprod] = toklev[*mem];
> mem++;
> t = gettok();
> }
> if(t == PREC) {
> if(gettok() != IDENTIFIER)
> error("illegal %%prec syntax");
> j = chfind(2, tokname);
> if(j >= NTBASE)
> error("nonterminal %s illegal after %%prec",
> nontrst[j-NTBASE].name);
> levprd[nprod] = toklev[j];
> t = gettok();
> }
> if(t == '=') {
> levprd[nprod] |= ACTFLAG;
> Bprint(faction, "\ncase %d:", nprod);
> cpyact(mem-prdptr[nprod]-1);
> Bprint(faction, " break;");
> if((t=gettok()) == IDENTIFIER) {
> 
> /* action within rule... */
> sprint(actnm, "$$%d", nprod);
> 
> /* make it a nonterminal */
> j = chfind(1, actnm);
> 
> /*
> * the current rule will become rule number nprod+1
> * move the contents down, and make room for the null
> */
> for(p = mem; p >= prdptr[nprod]; --p)
> p[2] = *p;
> mem += 2;
> 
> /* enter null production for action */
> p = prdptr[nprod];
> *p++ = j;
> *p++ = -nprod;
> 
> /* update the production information */
> levprd[nprod+1] = levprd[nprod] & ~ACTFLAG;
> levprd[nprod] = ACTFLAG;
> if(++nprod >= NPROD)
> error("more than %d rules", NPROD);
> prdptr[nprod] = p;
> 
> /* make the action appear in the original rule */
> *mem++ = j;
> 
> /* get some more of the rule */
> goto more_rule;
> }
> }
> 
> while(t == ';')
> t = gettok();
> *mem++ = -nprod;
> 
> /* check that default action is reasonable */
> if(ntypes && !(levprd[nprod]&ACTFLAG) && 
> nontrst[*prdptr[nprod]-NTBASE].value) {
> 
> /* no explicit action, LHS has value */
> int tempty;
> 
> tempty = prdptr[nprod][1];
> if(tempty < 0)
> error("must return a value, since LHS has a type");
> else
> if(tempty >= NTBASE)
> tempty = nontrst[tempty-NTBASE].value;
> else
> tempty = TYPE(toklev[tempty]);
> if(tempty != nontrst[*prdptr[nprod]-NTBASE].value)
> error("default action causes potential type clash");
> }
> nprod++;
> if(nprod >= NPROD)
> error("more than %d rules", NPROD);
> prdptr[nprod] = mem;
> levprd[nprod] = 0;
> }
> 
> /* end of all rules */
> defout(1);
> 
> finact();
> if(t == MARK) {
> Bprint(ftable, "\n");
> if(yyline)
> Bprint(ftable, "#line\t%d\t\"%s\"\n", lineno, infile);
> while((c=Bgetrune(finput)) != Beof)
> Bputrune(ftable, c);
> }
> Bterm(finput);
> }
> 
> 
>> On Wed, Nov 25, 2015 at 10:03 AM,  <plann...@sigint.cs.purdue.edu> wrote:
>> On Wed, Nov 25, 2015 at 09:25:55AM -0500, Brantley Coile wrote:
>> > unindented consequences
>> 
>> Is that a class of Python bugs or an awesome name for a Nerdcore band?
> 
> 
> 
> -- 
> Ryan
> [ERROR]: Your autotools build scripts are 200 lines longer than your program. 
> Something’s wrong.
> http://kirbyfan64.github.io/ 

Reply via email to