Add or update license in every file, update tests to put license at start of *.t...
authorNick Downing <nick@ndcode.org>
Mon, 28 Jan 2019 02:15:01 +0000 (13:15 +1100)
committerNick Downing <nick@ndcode.org>
Mon, 28 Jan 2019 10:27:44 +0000 (21:27 +1100)
12 files changed:
Makefile
ast.py
ast_to_pitree.py
expected.sh
generate_ast.py
generate_c.py
generate_py.py
markup.py
pitree.l
pitree.py
pitree.y
skel/skel_py.py

index 5637da2..893c992 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,3 +5,6 @@ lex_yy.py: pitree.l
 
 y_tab.py: pitree.y
        ../piyacc.git/piyacc.py --element --python $<
+
+clean:
+       rm -f lex_yy.py y_tab.py
diff --git a/ast.py b/ast.py
index 3314281..fd0fa75 100644 (file)
--- a/ast.py
+++ b/ast.py
@@ -1,3 +1,19 @@
+# Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# 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 Free Software
+# Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
 import element
 import sys
 
index b05abed..25e9a94 100755 (executable)
@@ -68,7 +68,27 @@ classes = []
 base_classes = [set(['element.Element'])]
 method = {}
 
-sys.stdout.write('%{\n')
+sys.stdout.write(
+  '''/*
+ * Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * 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 Free
+ * Software Foundation; version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+%{
+''')
 
 section2 = []
 delayed_line = ''
index 1f33308..1e94f7d 100755 (executable)
@@ -1,5 +1,31 @@
 #!/bin/sh
 cat <<EOF
+# Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+# SPDX-License-Identifier: GPL-2.0-with-bison-exception
+#
+# 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 Free Software
+# Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# As a special exception, you may create a larger work that contains part or
+# all of the pitree class definition skeleton and distribute that work under
+# terms of your choice, so long as that work isn't itself a class definition
+# generator using the skeleton or a modified version thereof as a class
+# definition skeleton. Alternatively, if you modify or redistribute the class
+# definition skeleton itself, you may (at your option) remove this special
+# exception, which will cause the skeleton and the resulting pitree output
+# files to be licensed under the GNU General Public License without this
+# special exception.
+
 # GENERATE SECTION1 BEGIN
 EOF
 sed -ne '/^%{/,/%}/p' <$2 |sed -ne '/^$/p; s/^  //p'
index f65d4f3..8904655 100755 (executable)
@@ -1,5 +1,21 @@
 #!/usr/bin/env python3
 
+# Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# 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 Free Software
+# Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
 import re
 import sys
 
index a7596d8..6f9602a 100644 (file)
@@ -1,2 +1,18 @@
+# Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# 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 Free Software
+# Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
 def generate_c(_ast, home_dir, skel_file, out_file):
   assert False
index 6f37472..f54cf7f 100644 (file)
@@ -1,3 +1,19 @@
+# Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# 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 Free Software
+# Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
 import ast
 import element
 import os
@@ -34,7 +50,7 @@ def generate_py(_ast, home_dir, skel_file, out_file):
   if skel_file is None:
     skel_file = os.path.join(home_dir, 'skel/skel_py.py')
   if out_file is None:
-    out_file = 't_ast.py'
+    out_file = 't_def.py'
   with open(skel_file, 'r') as fin:
     with open(out_file, 'w+') as fout:
       line = fin.readline()
index caf5a41..aab5b00 100755 (executable)
--- a/markup.py
+++ b/markup.py
@@ -1,5 +1,21 @@
 #!/usr/bin/env python3
 
+# Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# 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 Free Software
+# Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
 import ast
 import element
 import y_tab
index 2880930..dd4e051 100644 (file)
--- a/pitree.l
+++ b/pitree.l
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * 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 Free
+ * Software Foundation; version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
 %{
   import ast
   import y_tab
@@ -18,6 +36,7 @@
     BEGIN(SECTION2)
     return y_tab.SECTION2_START
   }
+  [[:blank:]]*"/*"             yy_push_state(COMMENT)
   [[:blank:]]*\n?
 }
 
     BEGIN(SECTION3)
     return y_tab.SECTION3_START
   }
-  "/*"                         BEGIN(COMMENT)
+  "/*"                         yy_push_state(COMMENT)
   [[:blank:]]+
   [[:space:]]
 }
 
 <COMMENT>{
-  "*/"                         BEGIN(SECTION2)
+  "*/"                         yy_pop_state()
   .|\n
 }
 
index b7fe14f..e00eeaf 100755 (executable)
--- a/pitree.py
+++ b/pitree.py
@@ -1,5 +1,21 @@
 #!/usr/bin/env python3
 
+# Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# 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 Free Software
+# Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
 import ast
 import element
 import generate_c
index bbd55d7..2c24fe5 100644 (file)
--- a/pitree.y
+++ b/pitree.y
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * 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 Free
+ * Software Foundation; version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
 %{
   import ast
 %}
index 46f124c..d365544 100644 (file)
@@ -1,3 +1,29 @@
+# Copyright (C) 2019 Nick Downing <nick@ndcode.org>
+# SPDX-License-Identifier: GPL-2.0-with-bison-exception
+#
+# 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 Free Software
+# Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# As a special exception, you may create a larger work that contains part or
+# all of the pitree class definition skeleton and distribute that work under
+# terms of your choice, so long as that work isn't itself a class definition
+# generator using the skeleton or a modified version thereof as a class
+# definition skeleton. Alternatively, if you modify or redistribute the class
+# definition skeleton itself, you may (at your option) remove this special
+# exception, which will cause the skeleton and the resulting pitree output
+# files to be licensed under the GNU General Public License without this
+# special exception.
+
 # GENERATE SECTION1
 
 # GENERATE SECTION2