Commit Graph

42 Commits (3e15dfc4cb94b58c4a2edfe987f3f91c61a68f1e)

Author SHA1 Message Date
John Benediktsson d6fd4215d2 formatting: better error messages for unknown directives. 2018-01-18 08:54:06 -08:00
Doug Coleman 15b13870ae peg.ebnf: Clean up EBNF: syntax.
The syntax for an EBNF parser is now ``EBNF: identifier string``. The
inline syntax went from [EBNF ...  EBNF] to EBNF[[ ]], EBNF[=[ ]=], etc.

<EBNF looked for a main word, but this functionality is just EBNF[[ ]]
now.
2017-08-05 22:23:57 -05:00
Jon Harper e470a5bb28 formatting, workaround bug for "%.0e" and "%.0f" on windows
On windows, the underlying formatting implementation
uses a precison of 6 when asked to do a precision of 0.
Improve the post-processing so that it doesn't fully break
the formatted number. The previous implementation would change
"1.00000" to "10000", and 1.00000e0 to 10000e0...

With this, windows has a different formatting for "%.0f" and "%.0e"
but at least it's the right number
2017-07-08 18:40:08 +02:00
Jon Harper 7c2e964fc9 formatting: fix exception when formatting the integer 0 using "%e" 2017-07-08 18:39:56 +02:00
John Benediktsson 0fddbc2af1 formatting: revert change to %d, %o, %b, %x for now.
We should have a format character in the future to format using our Factor
binary, octal, and hex parser.  Maybe using the "alternate form" format
character like Python does? And if we do that, maybe print the 0b, 0o, 0x
prefixes? TBD.
2017-06-10 13:33:01 -07:00
Jon Harper 1dceb069ad formatting: fix bug when using %e and the number rounds up in magnitude
99/10 0 format-scientific-simple was outputting 1.0e0 because
the mantissa was rounded up, so it had one extra character, and
the exponent was wrong.
2017-06-08 11:23:38 -07:00
Jon Harper 4df21818f5 formatting: change %.0f and %.0e to remove the radix character. It's more standard. 2017-06-08 11:23:38 -07:00
Jon Harper 552791d1cf formatting: don't force the presence of ".0" for %f and %e when precision is 0
It's misleading because you can think you have more precision than you really
do when looking at the output. So instead of "1.0", we can format it as "1" or
"1.".  And instead of "1.0e+00" we can format "1e+00" or "1.e+00".  In C,
printf does not print the radix character, it's prettier. But since the factor
parser accepts both styles, and keeping the radix character gives a stronger sense
that the number is approximate, I prefer to keep the radix character..
2017-06-08 11:23:38 -07:00
Jon Harper 6061da92be formatting, allow uppercase exponent for bin floats in base 2 and 8 2017-06-08 11:23:37 -07:00
Jon Harper ccbb8116fc formatting, make %d, %o, %b work for ratios and floats 2017-06-08 11:23:37 -07:00
Jon Harper 438e22fceb formatting, fix %f and %e for ratios and integers 2017-06-08 11:23:37 -07:00
Jon Harper e1df9df735 formatting: fix missing '+' for %+e with negative exponent 2017-06-08 11:23:37 -07:00
Björn Lindqvist f9b9ce20f2 calendar.english: new vocab for english names for days and months
This moves all the english-centric words from the calendar vocab which
was getting kind of big to calendar.english. It should make it easier to
see which vocabs make language assumptions.
2017-01-03 15:48:08 +01:00
John Benediktsson 498285d7dd unicode: make this the API for all unicode things. 2016-03-30 23:29:48 -07:00
Jon Harper cac9b58f11 formatting, format numbers with C locale and document that it's english only 2016-03-08 07:55:25 -08:00
Jon Harper 19fadb6c96 prettyprinter, locale independant float printing 2016-03-08 07:55:25 -08:00
John Benediktsson ceb75057da change ERROR: words from throw-foo back to foo. 2015-08-13 16:13:05 -07:00
Doug Coleman b6be8685c3 basis: ERROR: changes. 2015-08-13 03:20:39 -07:00
John Benediktsson c25fb5f55e update some more MACRO: effects. 2015-07-19 11:42:46 -07:00
Doug Coleman 2c257f399c factor: Rename MACRO: and MACRO: to have quot as the output in stack effects. 2015-07-18 22:16:11 -07:00
John Benediktsson 1723544b56 formatting: use nappend-as in sprintf. 2015-06-06 09:28:01 -07:00
John Benediktsson 50725002be formatting: support space prefix for numbers. 2015-04-17 17:50:00 -07:00
John Benediktsson 76761b2e59 more minor cleanup. 2014-11-30 19:26:23 -08:00
John Benediktsson 87433a4585 ``swap drop`` is ``nip``. 2014-08-05 10:31:42 -07:00
John Benediktsson 0287355e2a formatting: adding octal and binary format directives. 2014-08-05 09:39:50 -07:00
John Benediktsson 380251308e formatting: faster strftime and make parse-strftime match parse-printf. 2014-05-20 16:11:32 -07:00
John Benediktsson 6e0a9fdf1f formatting: make printf faster. 2014-02-10 20:39:08 -08:00
Björn Lindqvist a82dc84f2d formatting: new format specifier for unparsed representation 2014-02-09 21:09:24 -08:00
John Benediktsson f29aac24bb formatting: adding vprintf by request. 2013-05-14 09:23:00 -07:00
John Benediktsson fa0a0939f9 formatting: some cleanup, minor performance improvements. 2012-07-20 09:41:05 -07:00
Slava Pestov 8f4210436b formatting: use the new format-float word to fix a failing test case 2010-04-13 21:24:35 -07:00
Slava Pestov 050d042449 formatting: fix docs 2010-02-23 21:21:16 +13:00
Doug Coleman 7c92ab1ea5 move if-zero etc to math, remove 1-/1+ from math 2009-08-14 14:27:23 -05:00
Doug Coleman 3f3d57032b Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places, minor refactoring 2009-08-13 19:21:44 -05:00
Doug Coleman 4fef246ca4 add 10^ to math.functions and update usages 2009-08-11 18:00:24 -05:00
Slava Pestov b62630b5ac Updating code in basis and extra for stricter vocab search path semantics 2009-05-14 23:23:06 -05:00
Joe Groff bc07c075e7 Merge branch 'master' of git://factorcode.org/git/factor
Conflicts:
	extra/spheres/spheres.factor
2009-05-03 17:23:14 -05:00
Samuel Tardieu 087d931c36 Remove the tail argument from do/until/while 2009-02-18 02:41:14 +01:00
John Benediktsson 267e246766 Support "%s" for numbers, and add support for sequences and assocs formatting. 2009-01-30 14:17:12 -08:00
Doug Coleman 3c408342ef renaming: contain? -> any?, deep-contains? -> deep-any?, pad-left -> pad-head, pad-right -> pad-tail, trim-left -> trim-head, trim-right -> trim-tail 2009-01-29 22:19:07 -06:00
John Benediktsson b43dce4668 Merge branch 'master' of git://factorcode.org/git/factor 2008-12-18 06:50:42 -08:00
Slava Pestov da38cd36dd Move assoc-heaps, formatting, pack, roman, porter-stemmer, soundex, cords to basis 2008-12-17 20:18:24 -06:00