1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00
Commit Graph

131 Commits

Author SHA1 Message Date
Rob Rix
34e798cb09 Add a maybeUnionRanges function. 2016-03-04 19:59:31 -05:00
Rob Rix
3716048394 Define unionRanges in terms of unionRangesFrom. 2016-03-03 16:00:07 -05:00
Rob Rix
8637d6d384 Add a unionRangesFrom function taking a default Range. 2016-03-03 15:59:40 -05:00
Rob Rix
cf8673b14f Correct the docs of unionRanges. 2016-03-03 15:58:48 -05:00
Rob Rix
9981e98a77 Revert "Move safeRange into the Range module."
This reverts commit 781f940cad93db3954ddb9f2ddd9de23c432a68f.
2016-03-03 10:42:03 -05:00
Rob Rix
e630169833 Move safeRange into the Range module. 2016-03-02 18:54:12 -05:00
Rob Rix
9108b56e4f Add a rangeAt function to construct a Range at an index. 2016-02-29 10:00:02 -05:00
Rob Rix
c033182e5f Replace the Semigroup instance with a Monoid instance over Data.Option. 2016-02-26 19:55:14 -05:00
Matt Diephouse
5eb6ea0996 Document the declarations in Range.hs 2016-01-13 14:38:57 -05:00
Matt Diephouse
75e4f2b7bd Merge match, parse, and recurse into a single function 2016-01-13 14:06:59 -05:00
Matt Diephouse
52a8661390 Swap parameter order and eta reduce 2016-01-13 14:00:57 -05:00
Matt Diephouse
6f882be685 Extract the recursion into a function 2016-01-13 13:57:28 -05:00
Matt Diephouse
bc95741b0d Swap parameter order and eta reduce 2016-01-13 13:55:09 -05:00
Matt Diephouse
58b4e8a985 Extract saving of a word 2016-01-13 13:54:49 -05:00
Matt Diephouse
d7001befc6 Add a parse function to handle recursing 2016-01-13 13:52:07 -05:00
Matt Diephouse
8acdaaf1f5 Call it match instead of parse 2016-01-13 13:25:54 -05:00
Matt Diephouse
cc5a1b7736 Let the transform take 2 arguments 2016-01-13 13:03:11 -05:00
Matt Diephouse
09bdf89982 Make parse handle the fmap 2016-01-13 12:53:31 -05:00
Matt Diephouse
c478e19af6 Don't pass in string 2016-01-13 12:44:22 -05:00
Matt Diephouse
b5b00505cc Make take and skip take predicates 2016-01-13 12:39:52 -05:00
Matt Diephouse
06468b59de Negate isWordOrSpace and call it isPunctuation 2016-01-13 12:18:19 -05:00
Matt Diephouse
205f733132 Call these take and skip 2016-01-13 12:12:52 -05:00
Matt Diephouse
9d90206367 Use option instead of fromMaybe 2016-01-13 10:04:27 -05:00
Matt Diephouse
fd1305acd1 Move unionRange to be by unionRanges 2016-01-13 10:04:27 -05:00
Matt Diephouse
473866cb6a Use Option instead of creating a Union type 2016-01-13 10:04:26 -05:00
Matt Diephouse
f1cd77c9c3 Create a new type for unioning Range with a Monoid
The existing Monoid Range violated the Monoid identity law.
2016-01-13 10:04:26 -05:00
Matt Diephouse
1ebe7bb5ed Add a function to compute a range's length 2016-01-12 11:52:38 -05:00
Rob Rix
09459a3421 Merge branch 'master' into patch 2015-12-30 18:55:42 -05:00
Rob Rix
27a877e861 Generalize unionRanges to Foldable Functors.
We use `Foldable` and `Functor`, and not `Traversable`, because the
latter is not automatically implied by the former. I.e. we use the
minimum necessary set of constraints.
2015-12-30 13:45:04 -05:00
joshvera
c69cd164cd Merge remote-tracking branch 'origin/master' into use-text 2015-12-30 12:07:52 -05:00
Rob Rix
bb5a7f6218 Remove isEmpty. 2015-12-30 10:06:16 -05:00
Rob Rix
941d4d5ddb Add a unionRanges function to Range. 2015-12-30 10:05:31 -05:00
joshvera
a3051c531d Merge remote-tracking branch 'origin/master' into use-text 2015-12-29 15:13:57 -05:00
Rob Rix
989ef074df Add an isEmpty predicate on Range. 2015-12-28 13:03:26 -05:00
Rob Rix
7e2e40028f Add a Monoid instance for Range. 2015-12-28 12:35:43 -05:00
Rob Rix
4d368b0180 substring is a synonym for sublist. 2015-12-23 21:39:50 -05:00
Rob Rix
653acdc30f Add a sublist function. 2015-12-23 21:39:35 -05:00
Rob Rix
46635ccb60 Merge branch 'profiling-improvements' into split-performance
# Conflicts:
#	src/Range.hs
2015-12-23 19:50:27 -05:00
Rob Rix
ab7f748663 Use fromMaybe to expand the alternatives. 2015-12-23 17:48:43 -05:00
Rob Rix
24998db34e Range’s fields are strict. 2015-12-23 17:41:35 -05:00
Rob Rix
7f1079e0ca Document Range. 2015-12-21 12:23:21 -05:00
Rob Rix
1e2c1979ee Document maybeLastIndex. 2015-12-21 12:22:52 -05:00
Rob Rix
e823fb6281 Add a maybeLastIndex function over Range.
This is a better option than making Range Foldable at the moment.
2015-12-21 12:22:20 -05:00
joshvera
3d84692dfb totalRange takes a Text 2015-12-15 15:08:24 -05:00
joshvera
6eb8172fe4 output split diffs as Text 2015-12-15 13:29:58 -05:00
joshvera
9da52ff7f1 Start converting functions to use Text 2015-12-15 11:48:26 -05:00
Rob Rix
93cdcfc4e2 Extract the end index computation into a local binding. 2015-12-14 17:18:24 -05:00
Rob Rix
e7175b524a We already have a function for that. 2015-12-14 16:37:39 -05:00
Rob Rix
44c11647f8 Use the Alternative instance for skipping spaces too. 2015-12-14 16:34:52 -05:00
Rob Rix
645ae0b6de Use the space atom. 2015-12-14 16:33:02 -05:00
Rob Rix
36e495f918 Parse words and punctuation via the atoms. 2015-12-14 16:32:31 -05:00
Rob Rix
cf072208fd Extract word & punctuation & space into atoms. 2015-12-14 16:32:24 -05:00
Rob Rix
2ba26d8a47 Rename the function to reflect we care about spaces, not separators. 2015-12-14 16:31:29 -05:00
Rob Rix
2d2fc220fc fmap takeAndContinue. 2015-12-14 16:29:57 -05:00
Rob Rix
d59d0dbe86 Space, not separator. 2015-12-14 16:28:02 -05:00
Rob Rix
771ed5673e Use skipAndContinue in the space branch. 2015-12-14 16:27:50 -05:00
Rob Rix
025565ac68 Extract a skipAndContinue function. 2015-12-14 16:27:36 -05:00
Rob Rix
c1c50915d3 isSpace, not isSeparator. 2015-12-14 16:25:51 -05:00
Rob Rix
1d559b2b9a Fewer parentheses. 2015-12-14 16:24:03 -05:00
Rob Rix
e9f21668a1 Use Alternative to combine our non-skipped parsers. 2015-12-14 16:23:09 -05:00
Rob Rix
835a3a0245 Parse spans of words & non-word punctuation. 2015-12-14 16:20:42 -05:00
Rob Rix
be9e4c7a01 Add a function to take a range & substring & continue. 2015-12-14 16:20:09 -05:00
Rob Rix
9e4071eb35 Remove the word/punctuation/space predicates. 2015-12-14 16:19:34 -05:00
Rob Rix
9af8783d1e Add a word-or-separator predicate. 2015-12-14 16:19:21 -05:00
Rob Rix
a135c24967 Define the other parsers in terms of parse. 2015-12-14 16:08:52 -05:00
Rob Rix
5aa5361c4e Generalize. 2015-12-14 16:07:49 -05:00
Rob Rix
5825484fb3 Add parsers for words, punctuation, and spaces. 2015-12-14 16:07:06 -05:00
Rob Rix
9e01666d7d 🔥 rangesAndWordsAfterWhitespace. 2015-12-14 15:56:57 -05:00
Rob Rix
8990db2b79 Skip whitespace inline here too. 2015-12-14 15:56:44 -05:00
Rob Rix
cee1da65b4 Skip whitespace inline. 2015-12-14 15:55:02 -05:00
Rob Rix
cded6c0d7d Get the substrings out at the same time as computing the ranges. 2015-12-14 15:37:30 -05:00
Rob Rix
df4b74876a Rename the word ranges function. 2015-12-14 15:31:45 -05:00
Rob Rix
eb9f36870d Remove a redundant case.
This gets picked up adequately by the next one.
2015-12-14 15:30:53 -05:00
Rob Rix
170fc65f5c Test for word characters specifically. 2015-12-14 15:03:24 -05:00
Rob Rix
ca7e1f5ff1 Document the word character predicate. 2015-12-14 15:02:09 -05:00
Rob Rix
4fae286cf0 Add a character predicate to test for word characters. 2015-12-14 15:01:38 -05:00
Rob Rix
58830283d4 Correct rangesOfWordsFrom to produce start/end ranges, not start/length ranges. 2015-12-14 12:49:51 -05:00
Rob Rix
bf9aa915a3 Move rangesOfWordsFrom into Range.hs. 2015-12-14 12:44:48 -05:00
Rob Rix
6cef2cb17f Add a function to offset ranges. 2015-12-14 12:20:51 -05:00
Rob Rix
19ff0415d6 Add a convenience to construct the complete range of a list. 2015-12-04 09:20:23 -05:00
joshvera
2a063d3277 Move Range to a module 2015-12-02 21:40:34 -05:00