38 Commits

Author SHA1 Message Date
David Dufresne
9f408d63f3 Rename some unit test classes
Rename some unit test classes according to their corresponding classes.
2017-02-04 08:46:31 -05:00
David Dufresne
8f32dae968 Move Linux test methods listing to class extensions
Instead of centralizing the listing of Linux test methods in
LinuxMain.swift put them in class extensions. It will be easier to
manage and make sure no method is forgotten.
2017-02-04 08:22:37 -05:00
Kofi Gumbs
a218d1be0e Conform to documentation comment conventions 2017-01-20 10:05:03 -07:00
Kofi Gumbs
65e9942fa8 Conditionally compile around Bundle.init(for:) 2017-01-20 10:03:48 -07:00
Kofi Gumbs
c9384291ed Fix silent CharacterSet compatibility bug 2017-01-14 15:44:57 -05:00
Kofi Gumbs
8254bf8a70 Get Tests to compile on Linux 2017-01-13 20:16:04 -05:00
Kofi Gumbs
b825dffcac Build LinuxMain test file 2017-01-13 20:15:58 -05:00
Kofi Gumbs
c0a403d2f6 Make Foundation changes for Linux compilation 2017-01-10 11:43:33 -05:00
David Dufresne
649d976398 Check if the SampleJSON.json file exists
When using the package manager the SampleJSON.json file is not copied to
the bundle. So check if it exists before launching the benchmark.
2016-10-08 19:24:18 -04:00
David Dufresne
e998813c86 Put TokenParser extension in its own file
Improve file layout by putting the TokenParser extension in its own
file.
2016-10-08 19:24:17 -04:00
David Dufresne
cb4818646a Rename Combinator.swift to CombinatorParsers.swift
Give a more meaningful file name and rename the corresponding test file.
2016-10-08 19:08:32 -04:00
David Dufresne
468dd4d712 Rename Character.swift to CharacterParsers.swift
Give a more meaningful file name and rename the corresponding test file.
2016-10-08 19:08:32 -04:00
David Dufresne
7385294ee1 Improve code comments
Batch improvements to code comments. Use separator to make it easier to
visually navigate files.
2016-10-08 19:08:30 -04:00
David Dufresne
462993f1f8 Rename Expression.swift to ExpressionParser.swift
The new name better reflects the content of the file.
2016-10-08 19:06:35 -04:00
David Dufresne
d79fba7d25 Rename Token.swift to TokenParser.swift
The new name better reflects the content of the file.
2016-10-08 19:06:35 -04:00
David Dufresne
f76feefb72 Fix package configuration for Swift 3
Make the package description valid by adding the 'targets' parameter.

Fix error 'the the name of a test module has no ‘Tests’ suffix' by
adding the required suffix.
2016-10-08 19:06:35 -04:00
David Dufresne
e03620c8ab Follow case conventions
Acronyms and initialisms that commonly appear as all upper case in
American English should be uniformly up- or down-cased according to case
conventions.
2016-10-08 19:06:35 -04:00
David Dufresne
f8d143cbfa Rename class to be more descriptive
Rename BenchmarkTest to JSONBenchmarkTests because the test is performed
using a JSON parser.
2016-10-08 19:06:35 -04:00
David Dufresne
333b1a67b5 Replace dynamicType by function type(of:)
The dynamicType keyword has been removed from Swift. In its place, a new
primitive function type(of:) has been added to the language.
2016-10-08 19:06:35 -04:00
David Dufresne
46669773c9 Add label 'describing' to String initializer
Fix error: 'init' has been renamed to 'init(describing:)'
2016-10-08 19:06:32 -04:00
David Dufresne
6005aa46d7 Change the closure escaping annotation
Closure parameters are non-escaping by default, rather than explicitly
being annotated with @noescape. Use @escaping to indicate that a closure
parameter may escape.
2016-10-08 19:04:33 -04:00
David Dufresne
80857bc01a Move 'where' clause next to generic parameters
Compiler warning: 'where' clause next to generic parameters is
deprecated and will be removed in the future version of Swift.
2016-10-08 19:04:33 -04:00
David Dufresne
9fe0f97481 Add Parsec.userState method
Instead of only having access to the user state through the
`Parsec.run()` method, add the `Parsec.userState` parser.
2016-10-08 19:04:33 -04:00
David Dufresne
57917ea2e4 Update syntax according to changes introduced in Xcode 8 beta 4 2016-10-08 19:04:33 -04:00
David Dufresne
7d1d4db6d3 Update condition clauses to new syntax
From Xcode 8 beta 3 release notes:
Condition clauses in if, guard, and while statements now use a more
regular syntax. Each pattern or optional binding must be prefixed with
case or let respectively, and all conditions are separated
by , instead of where.
2016-10-08 19:04:33 -04:00
David Dufresne
152f7b79bd Add parser giving access to the source position
The source position might be useful in different situations. For
example, to generate customized error messages or add positions to AST
nodes.
2016-10-08 19:04:33 -04:00
David Dufresne
f5e12e2c2e Make unit tests error messages consistent
Different formulations are used for unit tests error messages. Use the
form "should..." for all error messages.
2016-10-08 19:04:33 -04:00
David Dufresne
3c9de864de Wrap statements at 80 characters (TokenTest.swift)
Xcode automatically wraps long statements. Now that Swift is open source other
editors with a different behaviour might be used. Also it makes it easier to
read when reviewing patches or when looking at the code on Github.
2016-10-08 19:04:33 -04:00
David Dufresne
375db9f831 Add benchmark to test JSON file parsing speed
The goal is to measure the impact of changes on the parsing speed of the
library. It can be used as a tool to prevent performance degradation.
2016-10-08 19:04:32 -04:00
David Dufresne
63ded65f70 Wrap statements at 80 characters
Xcode automatically wraps long statements. Now that Swift is open source other
editors with a different behaviour might be used. Also it makes it easier to
read when reviewing patches or when looking at the code on Github.
2016-10-08 19:04:29 -04:00
David Dufresne
8d1682d849 Wrap comments at 80 characters
Xcode automatically wraps long comments. But, since Swift is now open source
other editors with a different behaviour might be used. Also it makes it
easier to read when reviewing patches or when looking at the code on
Github.
2016-10-08 18:49:34 -04:00
David Dufresne
d9ab775e1b Remove useless initialization of a String with a string
Instead of initializing a `String` with a string use the string
directly.
2016-10-08 18:46:02 -04:00
David Dufresne
992310a154 Use Xcode tool to complete code migration to Swift 3.0
After the migration fix warnings that didn't show with Swift 2.2
compiler.
2016-10-08 18:46:02 -04:00
David Dufresne
34fef431a0 Change enum cases to lowercase
To conform to the Swift API design guidelines change enum cases to
lowercase. (see
https://swift.org/documentation/api-design-guidelines/#general-conventions)
2016-10-08 18:46:02 -04:00
David Dufresne
5d60a964b8 Change factory method expressionParser() to makeExpressionParser()
Conform to API Design Guidelines:
  - Begin names of factory methods with "make", e.g. `x.makeIterator()`.
  - Label closure parameters.

See
https://swift.org/documentation/api-design-guidelines/#strive-for-fluent-usage
https://swift.org/documentation/api-design-guidelines/#special-instructions
2016-10-08 18:46:02 -04:00
David Dufresne
2e7e35482d Change name of factory method parser to makeParser()
Conform to API Design Guidelines: Begin names of factory methods with
"make", e.g. `x.makeIterator()`. See
https://swift.org/documentation/api-design-guidelines/#strive-for-fluent-usage
2016-10-08 18:46:02 -04:00
David Dufresne
9d7e296101 Add last property to String
The `String.last` property makes it clearer and simpler to get the last
character of a string.
2016-10-08 16:47:08 -04:00
David Dufresne
ae3a4fff7b Reorganize source code in the file system for Swift Package Manager
Reorganize source code to be able to use the Swift Package Manager 0.1.
2016-10-08 16:47:08 -04:00