Commit Graph

11 Commits

Author SHA1 Message Date
Daniel Duan
fdae97aaad [gyb] Remove Python 2 (#42046) 2022-03-28 12:29:39 -07:00
Jason Barrett Prado
17e5594bec Make gyb explicitly reference python2.7
The default python on some systems is not 2.7, but gyb needs python2.7
precisely.
2016-03-03 16:14:26 -08:00
Dave Abrahams
af8421cac8 [utils] Move gyb into a .py file
This allows Python or .gyb files to do "import gyb" and use the basic
components of the system.  For example, we could create a Python
function to generate the boilerplate for a Mirror.  That function could
use gyb.parseTemplate() to load an inline template and
gyb.executeTemplate() to generate the code.  Then calls to that function
can be embedded in ${...} in a .gyb file.

Swift SVN r19490
2014-07-02 23:38:47 +00:00
Dave Abrahams
19f22d9f57 [utils] gyb/line-directive: fix up line alignment
Needed to properly map a file's first line to itself in the absence of a
directive.  We were also off by two columns due to a stray +2

Swift SVN r15682
2014-03-31 16:37:51 +00:00
Dave Abrahams
c733f3e419 [build] Integrate gyb line-directive processing
Diagnostic output from compiling .swift files is now passed through the
line-directive tool so that errors point back at the original .gyb
files.

Swift SVN r15674
2014-03-31 08:42:56 +00:00
Dave Abrahams
b429fb5ebb [utils] gyb: generate line directives
Swift SVN r15343
2014-03-21 22:11:47 +00:00
Dave Abrahams
5b545d40ec [utils] gyb: store token match in parse context
Swift SVN r15342
2014-03-21 22:11:46 +00:00
Dave Abrahams
8599a6bf5e [utils] gyb: useful match object for literal text
Literal text was being returned from the tokenizer with the regexp match
object for the /next/ token, if any.  We need to know the beginning of
the text if we're going to generate #line markers.

Swift SVN r15341
2014-03-21 22:11:46 +00:00
Dave Abrahams
930ba7b65f [build] Always self-test gyb when we run it
This is fast enough to do all the time and will prevent problems like
  the one noted as fixed below.

Also, fix a gyb self-test that had drifted out-of-date.

Swift SVN r14484
2014-02-27 23:16:08 +00:00
Dave Abrahams
03d2ce75d5 [utils] gyb: use % instead of @
It was hard to decide on a replacement character for @, which is a
particularly bad choice for gyb ever since we started using it for
attributes in Swift, since attributes often start a line.  Only
graphically-dense characters seem to look right.  '%' has the
disadvantage of clashing with SIL, where it begins many lines, but we're
not using gyb to generate any SIL files today, so I optimized for the
common case.

Swift SVN r14483
2014-02-27 23:16:07 +00:00
Jordan Rose
9a4528c904 Move gyb from tools/ to utils/
For consistency with the vague idea that things that are only useful for
compiler developers should go in utils/, not tools/. Unless they need
build system support.

Swift SVN r9433
2013-10-17 00:08:48 +00:00