Commit 7e57da12 by James A. Morrison

lex.l: Remove random whitespace.

2004-10-02  James A. Morrison  <phython@gcc.gnu.org>

        * lex.l: Remove random whitespace.
        * parse.y: Reformat copyright notice.  Indent declarations.
        Wrap long lines, unwrap short lines.
        * tree1.c: Reformat copyright notice.  Wrap long lines.
        Remove random whitespace.
        (lookup_tree_name): Use LOCATION_LINE.
        * treetree.c: Reformat copyright notice.  Wrap long lines.
        Remove random whitespace.

From-SVN: r88428
parent 1abb828a
2004-10-02 James A. Morrison <phython@gcc.gnu.org>
* lex.l: Remove random whitespace.
* parse.y: Reformat copyright notice. Indent declarations.
Wrap long lines, unwrap short lines.
* tree1.c: Reformat copyright notice. Wrap long lines.
Remove random whitespace.
(lookup_tree_name): Use LOCATION_LINE.
* treetree.c: Reformat copyright notice. Wrap long lines.
Remove random whitespace.
2004-10-01 James A. Morrison <phython@gcc.gnu.org> 2004-10-01 James A. Morrison <phython@gcc.gnu.org>
* parse.y (ELSE): Set tok to $1. * parse.y (ELSE): Set tok to $1.
......
...@@ -29,9 +29,7 @@ ...@@ -29,9 +29,7 @@
--------------------------------------------------------------------- ---------------------------------------------------------------------
Written by Tim Josling 1999-2001, based in part on other parts of Written by Tim Josling 1999-2001, based in part on other parts of
the GCC compiler. the GCC compiler. */
*/
%{ %{
#include "config.h" #include "config.h"
...@@ -51,7 +49,7 @@ extern int option_lexer_trace; ...@@ -51,7 +49,7 @@ extern int option_lexer_trace;
int yylex (void); int yylex (void);
void update_yylval (int a); void update_yylval (int a);
static int next_tree_charno=1; static int next_tree_charno = 1;
static void update_lineno_charno (void); static void update_lineno_charno (void);
static void dump_lex_value (int lexret); static void dump_lex_value (int lexret);
...@@ -80,13 +78,13 @@ static void dump_lex_value (int lexret); ...@@ -80,13 +78,13 @@ static void dump_lex_value (int lexret);
[ \n\t]+ { [ \n\t]+ {
update_lineno_charno (); update_lineno_charno ();
NOT_RETURN (WHITESPACE); NOT_RETURN (WHITESPACE);
} }
"//".* { "//".* {
/* Comment. */ /* Comment. */
update_lineno_charno (); update_lineno_charno ();
NOT_RETURN (COMMENT); NOT_RETURN (COMMENT);
} }
"{" { "{" {
...@@ -254,7 +252,7 @@ void ...@@ -254,7 +252,7 @@ void
update_yylval (int a) update_yylval (int a)
{ {
struct prod_token_parm_item * tok; struct prod_token_parm_item * tok;
tok=yylval; tok = yylval;
tok->category = token_category; tok->category = token_category;
tok->type = a; tok->type = a;
......
/* /* TREELANG Compiler almost main (tree1)
Called by GCC's toplev.c
TREELANG Compiler almost main (tree1) Copyright (C) 1986, 87, 89, 92-96, 1997, 1999, 2000, 2001, 2002, 2003, 2004
Called by GCC's toplev.c Free Software Foundation, Inc.
Copyright (C) 1986, 87, 89, 92-96, 1997, 1999, 2000, 2001, 2002, 2003, 2004 This program is free software; you can redistribute it and/or modify it
Free Software Foundation, Inc. under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is free software; you can redistribute it and/or modify it This program is distributed in the hope that it will be useful,
under the terms of the GNU General Public License as published by the but WITHOUT ANY WARRANTY; without even the implied warranty of
Free Software Foundation; either version 2, or (at your option) any MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
later version. GNU General Public License for more details.
This program is distributed in the hope that it will be useful, You should have received a copy of the GNU General Public License
but WITHOUT ANY WARRANTY; without even the implied warranty of along with this program; if not, write to the Free Software
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Foundation, 59 Temple Place - Suite 330,
GNU General Public License for more details. Boston, MA 02111-1307, USA.
You should have received a copy of the GNU General Public License In other words, you are welcome to use, share and improve this program.
along with this program; if not, write to the Free Software You are forbidden to forbid anyone else to use, share and improve
Foundation, 59 Temple Place - Suite 330, what you give them. Help stamp out software-hoarding!
Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program. ---------------------------------------------------------------------------
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
--------------------------------------------------------------------------- Written by Tim Josling 1999, 2000, 2001, based in part on other
parts of the GCC compiler. */
Written by Tim Josling 1999, 2000, 2001, based in part on other
parts of the GCC compiler.
*/
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
...@@ -232,19 +228,21 @@ lookup_tree_name (struct prod_token_parm_item *prod) ...@@ -232,19 +228,21 @@ lookup_tree_name (struct prod_token_parm_item *prod)
sanity_check (this_tok); sanity_check (this_tok);
if (tok->tp.tok.length != this_tok->tp.tok.length) if (tok->tp.tok.length != this_tok->tp.tok.length)
continue; continue;
if (memcmp (tok->tp.tok.chars, this_tok->tp.tok.chars, this_tok->tp.tok.length)) if (memcmp (tok->tp.tok.chars, this_tok->tp.tok.chars,
this_tok->tp.tok.length))
continue; continue;
if (option_parser_trace) if (option_parser_trace)
fprintf (stderr, "Found symbol %s (%i:%i) as %i \n", fprintf (stderr, "Found symbol %s (%i:%i) as %i \n",
tok->tp.tok.chars, tok->tp.tok.chars, LOCATION_LINE (tok->tp.tok.location),
tok->tp.tok.location.line, tok->tp.tok.charno, tok->tp.tok.charno, NUMERIC_TYPE (this));
NUMERIC_TYPE (this));
return this; return this;
} }
if (option_parser_trace) if (option_parser_trace)
fprintf (stderr, "Not found symbol %s (%i:%i) as %i \n", fprintf (stderr, "Not found symbol %s (%i:%i) as %i \n",
tok->tp.tok.chars, tok->tp.tok.chars, LOCATION_LINE (tok->tp.tok.location),
tok->tp.tok.location.line, tok->tp.tok.charno, tok->type); tok->tp.tok.charno, tok->type);
return NULL; return NULL;
} }
...@@ -290,7 +288,7 @@ sanity_check (struct prod_token_parm_item *item) ...@@ -290,7 +288,7 @@ sanity_check (struct prod_token_parm_item *item)
{ {
switch (item->category) switch (item->category)
{ {
case token_category: case token_category:
case production_category: case production_category:
case parameter_category: case parameter_category:
break; break;
......
/* /* TREELANG Compiler interface to GCC's middle end (treetree.c)
Called by the parser.
TREELANG Compiler interface to GCC's middle end (treetree.c)
Called by the parser.
If you want a working example of how to write a front end to GCC, If you want a working example of how to write a front end to GCC,
you are in the right place. you are in the right place.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This code is based on toy.c written by Richard Kenner. This code is based on toy.c written by Richard Kenner.
It was later modified by Jonathan Bartlett whose changes have all It was later modified by Jonathan Bartlett whose changes have all
been removed (by Tim Josling). been removed (by Tim Josling).
Various bits and pieces were cloned from the GCC main tree, as Various bits and pieces were cloned from the GCC main tree, as
GCC evolved, for COBOLForGCC, by Tim Josling. GCC evolved, for COBOLForGCC, by Tim Josling.
It was adapted to TREELANG by Tim Josling 2001. It was adapted to TREELANG by Tim Josling 2001.
Updated to function-at-a-time by James A. Morrison, 2004. Updated to function-at-a-time by James A. Morrison, 2004.
--------------------------------------------------------------------------- -----------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any Free Software Foundation; either version 2, or (at your option) any
later version. later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program. In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! what you give them. Help stamp out software-hoarding!
--------------------------------------------------------------------------- ----------------------------------------------------------------------- */
*/ /* Assumption: garbage collection is never called implicitly. It will
not be called 'at any time' when short of memory. It will only be
/* called explicitly at the end of each function. This removes the
Assumption: garbage collection is never called implicitly. It will need for a *lot* of bother to ensure everything is in the mark trees
not be called 'at any time' when short of memory. It will only be at all times. */
called explicitly at the end of each function. This removes the
need for a *lot* of bother to ensure everything is in the mark trees
at all times. */
/* Note, it is OK to use GCC extensions such as long long in a compiler front /* Note, it is OK to use GCC extensions such as long long in a compiler front
end. This is because the GCC front ends are built using GCC. */ end. This is because the GCC front ends are built using GCC. */
...@@ -263,7 +258,8 @@ tree_code_if_start (tree exp, location_t loc) ...@@ -263,7 +258,8 @@ tree_code_if_start (tree exp, location_t loc)
{ {
tree cond_exp, cond; tree cond_exp, cond;
cond_exp = fold (build2 (NE_EXPR, boolean_type_node, exp, cond_exp = fold (build2 (NE_EXPR, boolean_type_node, exp,
fold (build1 (CONVERT_EXPR, TREE_TYPE (exp), integer_zero_node)))); fold (build1 (CONVERT_EXPR, TREE_TYPE (exp),
integer_zero_node))));
SET_EXPR_LOCATION (cond_exp, loc); SET_EXPR_LOCATION (cond_exp, loc);
cond = build3 (COND_EXPR, void_type_node, cond_exp, NULL_TREE, cond = build3 (COND_EXPR, void_type_node, cond_exp, NULL_TREE,
NULL_TREE); NULL_TREE);
...@@ -603,7 +599,6 @@ tree_code_create_variable (unsigned int storage_class, ...@@ -603,7 +599,6 @@ tree_code_create_variable (unsigned int storage_class,
TYPE_NAME (TREE_TYPE (var_decl)) = TYPE_NAME (var_type); TYPE_NAME (TREE_TYPE (var_decl)) = TYPE_NAME (var_type);
return pushdecl (copy_node (var_decl)); return pushdecl (copy_node (var_decl));
} }
...@@ -744,8 +739,8 @@ tree_code_get_expression (unsigned int exp_type, ...@@ -744,8 +739,8 @@ tree_code_get_expression (unsigned int exp_type,
{ {
tree fun_ptr; tree fun_ptr;
fun_ptr = fold (build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (op1)), fun_ptr = fold (build1 (ADDR_EXPR,
op1)); build_pointer_type (TREE_TYPE (op1)), op1));
ret1 = build3 (CALL_EXPR, type, fun_ptr, nreverse (op2), NULL_TREE); ret1 = build3 (CALL_EXPR, type, fun_ptr, nreverse (op2), NULL_TREE);
} }
break; break;
...@@ -773,8 +768,8 @@ tree_code_add_parameter (tree list, tree proto_exp, tree exp) ...@@ -773,8 +768,8 @@ tree_code_add_parameter (tree list, tree proto_exp, tree exp)
{ {
tree new_exp; tree new_exp;
new_exp = tree_cons (NULL_TREE, new_exp = tree_cons (NULL_TREE,
fold (build1 (CONVERT_EXPR, TREE_TYPE (proto_exp), exp)), fold (build1 (CONVERT_EXPR, TREE_TYPE (proto_exp),
NULL_TREE); exp)), NULL_TREE);
if (!list) if (!list)
return new_exp; return new_exp;
return chainon (new_exp, list); return chainon (new_exp, list);
......
Markdown is supported
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