summaryrefslogtreecommitdiff
path: root/compiler/parser/Lexer.x
Commit message (Collapse)AuthorAgeFilesLines
...
* Make the Parser Monad's return strictIan Lynagh2008-01-241-1/+1
|
* Whitespace onlyIan Lynagh2008-01-231-12/+13
|
* FIX #1821 (Parser or lexer mess-up)df@dfranke.us2007-12-101-1/+1
|
* Add quasi-quotation, courtesy of Geoffrey Mainlandsimonpj@microsoft.com2008-01-181-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds quasi-quotation, as described in "Nice to be Quoted: Quasiquoting for Haskell" (Geoffrey Mainland, Haskell Workshop 2007) Implemented by Geoffrey and polished by Simon. Overview ~~~~~~~~ The syntax for quasiquotation is very similar to the existing Template haskell syntax: [$q| stuff |] where 'q' is the "quoter". This syntax differs from the paper, by using a '$' rather than ':', to avoid clashing with parallel array comprehensions. The "quoter" is a value of type Language.Haskell.TH.Quote.QuasiQuoter, which contains two functions for quoting expressions and patterns, respectively. quote = Language.Haskell.TH.Quote.QuasiQuoter quoteExp quotePat quoteExp :: String -> Language.Haskell.TH.ExpQ quotePat :: String -> Language.Haskell.TH.PatQ TEXT is passed unmodified to the quoter. The context of the quasiquotation statement determines which of the two quoters is called: if the quasiquotation occurs in an expression context, quoteExp is called, and if it occurs in a pattern context, quotePat is called. The result of running the quoter on its arguments is spliced into the program using Template Haskell's existing mechanisms for splicing in code. Note that although Template Haskell does not support pattern brackets, with this patch binding occurrences of variables in patterns are supported. Quoters must also obey the same stage restrictions as Template Haskell; in particular, in this example quote may not be defined in the module where it is used as a quasiquoter, but must be imported from another module. Points to notice ~~~~~~~~~~~~~~~~ * The whole thing is enabled with the flag -XQuasiQuotes * There is an accompanying patch to the template-haskell library. This involves one interface change: currentModule :: Q String is replaced by location :: Q Loc where Loc is a data type defined in TH.Syntax thus: data Loc = Loc { loc_filename :: String , loc_package :: String , loc_module :: String , loc_start :: CharPos , loc_end :: CharPos } type CharPos = (Int, Int) -- Line and character position So you get a lot more info from 'location' than from 'currentModule'. The location you get is the location of the splice. This works in Template Haskell too of course, and lets a TH program generate much better error messages. * There's also a new module in the template-haskell package called Language.Haskell.TH.Quote, which contains support code for the quasi-quoting feature. * Quasi-quote splices are run *in the renamer* because they can build *patterns* and hence the renamer needs to see the output of running the splice. This involved a bit of rejigging in the renamer, especially concerning the reporting of duplicate or shadowed names. (In fact I found and removed a few calls to checkDupNames in RnSource that are redundant, becuase top-level duplicate decls are handled in RnNames.)
* import ord that alex secretly importedIsaac Dupree2007-12-281-1/+1
|
* Implement generalised list comprehensionssimonpj@microsoft.com2007-12-201-1/+13
| | | | | | | | | | | | | | | | | | | | This patch implements generalised list comprehensions, as described in the paper "Comprehensive comprehensions" (Peyton Jones & Wadler, Haskell Workshop 2007). If you don't use the new comprehensions, nothing should change. The syntax is not exactly as in the paper; see the user manual entry for details. You need an accompanying patch to the base library for this stuff to work. The patch is the work of Max Bolingbroke [batterseapower@hotmail.com], with some advice from Simon PJ. The related GHC Wiki page is http://hackage.haskell.org/trac/ghc/wiki/SQLLikeComprehensions
* Refactor Haddock optionsDavid Waern2007-11-011-11/+17
| | | | | | | | | | | | | | This patch renames the DOC_OPTIONS pragma to OPTIONS_HADDOCK. It also adds "-- # ..."-style Haddock option pragmas, for compatibility with code that use them. Another change is that both of these two pragmas behave like OPTIONS_GHC, i.e. they are only allowed at the top of the module, they are ignored everywhere else and they are stored in the dynflags. There is no longer any Haddock options in HsSyn. Please merge this to the 6.8.2 branch when 6.8.1 is out, if appropriate.
* Change DOCOPTIONS pragma to DOC_OPTIONSDavid Waern2007-10-021-1/+1
| | | | MERGE TO STABLE
* Fix CodingStyle#Warnings URLsIan Lynagh2007-09-041-1/+1
|
* Use OPTIONS rather than OPTIONS_GHC for pragmasIan Lynagh2007-09-031-2/+2
| | | | | | | Older GHCs can't parse OPTIONS_GHC. This also changes the URL referenced for the -w options from WorkingConventions#Warnings to CodingStyle#Warnings for the compiler modules.
* Add {-# OPTIONS_GHC -w #-} and some blurb to all compiler modulesIan Lynagh2007-09-011-0/+7
|
* Add a deprecated warning for _scc_Ian Lynagh2007-08-161-6/+8
|
* Change standalone deriving syntax and semantics; fixes trac #1481Ian Lynagh2007-08-101-3/+0
| | | | | You now say deriving instance Cxt => Head
* Warning police: eliminate all defaulting within stage1Isaac Dupree2007-08-071-1/+1
| | | | | | | | Defaulting makes compilation of multiple modules more complicated (re: #1405) Although it was all locally within functions, not because of the module monomorphism-restriction... but it's better to be clear what's meant, anyway. I changed some that were defaulting to Integer, to explicit Int, where Int seemed appropriate rather than Integer.
* Rename Opt_TH to Opt_TemplateHaskell to match the language nameIan Lynagh2007-08-041-1/+1
|
* Rename Opt_FFI to Opt_ForeignFunctionInterface to match the language nameIan Lynagh2007-08-041-1/+1
|
* FIX #1215: GHC fails to respect the maximal munch rule while lexing ↵Simon Marlow2007-07-241-32/+1
| | | | | | | | | | | | | | | | | | | "qualified reservedids" I didn't actually fix this to respect Haskell 98, instead I changed it to follow the proposal for Haskell': http://hackage.haskell.org/cgi-bin/haskell-prime/trac.cgi/wiki/QualifiedIdentifiers Rationale: - We didn't respect Haskell 98 with respect to qualified symbols either - The Haskell' change makes things much cleaner - Obeying the Haskell 98 spec literally has some unintended consequences (e.g. M.where must lex as "M.wher" "e") - Any programs that compiled before this change and do not compile after it were illegal according to Haskell 98 anyway.
* Implement -XStandaloneDeriving, the lexer is now glaexts-freeIan Lynagh2007-07-101-32/+29
|
* 'a'# syntax is enabled by the MagicHash extensionIan Lynagh2007-07-101-2/+2
|
* "Foo"# syntax is enabled by the MagicHash extensionIan Lynagh2007-07-101-2/+2
|
* 5# syntax is enabled by the MagicHash extensionIan Lynagh2007-07-101-9/+9
|
* {| and |} are -fgenerics syntaxIan Lynagh2007-07-101-3/+6
|
* Rank 2 and rank n types enable explicit forall syntaxIan Lynagh2007-07-101-0/+2
|
* RULES pragmas only need explicitForallEnabled, no -fglasgow-extsIan Lynagh2007-07-101-6/+7
|
* Implement unboxed tuples flagsIan Lynagh2007-07-091-2/+10
| | | | | | -XUnboxedTuples -XExpressionSignaturesUnboxedTuples -XTypeSynonymUnboxedTuples
* Add -XExistentialQuantification flagIan Lynagh2007-07-091-0/+1
|
* Implement -XPolymorphicComponentsIan Lynagh2007-07-091-0/+1
|
* rename tv -> explicitForallIan Lynagh2007-07-091-6/+7
|
* Implement -XUnicodeSyntaxIan Lynagh2007-07-091-32/+39
|
* Implement -XRecursiveDoIan Lynagh2007-07-081-2/+5
|
* Implement -XKindSignaturesIan Lynagh2007-07-081-1/+4
|
* Support the MagicHash extension as a flag and LANGUAGE pragmaIan Lynagh2007-07-081-24/+27
|
* #1318: lex negative unboxed literalsIsaac Dupree2007-05-261-30/+50
| | | | | | I reorganized the lexing of numeric literals a bit so the code didn't get too ugly, after trying a few ways, and also considering possible plans to be able to conditionally lex negative _boxed_ literals.
* parseInteger->parseUnsignedInteger to clarify meaningIsaac Dupree2007-05-261-7/+7
| | | | | | | | I decided against adding parseSignedInteger since octal and hex literals often have junk between the '-' and the digits, but, compare to Util.readRational which does handle signed numbers. Also since Integers - mathematically and in Haskell - can be negative, normally.
* -findexed-types -> -ftype-familiesManuel M T Chakravarty2007-05-141-11/+11
| | | | | | . This change tracks our current terminology. It'll break all programs using the old option, sorry. But this has only been an experimental feature in the HEAD so far.
* Documented the Unicode tricks that are being played in the lexersMichael D. Adams2007-05-101-6/+9
|
* FIX parsing of Haddock comments (broken by me in the previous patch)Simon Marlow2007-05-081-1/+12
|
* properly fix leakage of Haddock comment syntax (see #1091, test: read044)Simon Marlow2007-05-071-16/+9
|
* restore the correct Unicode ellipsis characterSimon Marlow2007-04-261-1/+1
| | | | | It looks like this was accidentally replaced with '?' in the patch "HsSyn clean up for indexed types". (see bug #1294)
* Remove code that is dead, as we require __GLASGOW_HASKELL__ >= 504Ian Lynagh2007-04-061-5/+0
|
* Remove special lambda unicode character, it didn't work anywaySimon Marlow2007-01-161-1/+0
| | | | | | | | | Since lambda is a lower-case letter, it's debatable whether we want to steal it to mean lambda in Haskell source. However if we did, then we would probably want to make it a "special" symbol, not just a reserved symbol, otherwise writing \x->... (using unicode characters of course) wouldn't work, because \x would be treated as a single identifier, you'd need a space.
* Add a warning for tabs in source filesIan Lynagh2007-01-121-2/+32
|
* HsSyn clean up for indexed typesManuel M T Chakravarty2007-01-051-3/+1
| | | | | | | | | | - This patch cleans up the HsSyn representation of type family declarations. - The new representation is not only less delicate, it also simplified teh code a bit. - I took the opportunity of stream lining the terminology and function names at the same time. - I also updated the description on the wiki at <http://hackage.haskell.org/trac/ghc/wiki/TypeFunctionsSyntax>
* Standalone deriving wibbles: keyword is 'derive' not 'derived'; and add flag ↵simonpj@microsoft.com2007-01-021-3/+3
| | | | documentation
* Big tidy-up of deriving codesimonpj@microsoft.com2007-01-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This tidy-up, triggered by Trac #1068, re-factors the way that 'deriving' happens. It took me way longer than I had intended. The main changes, by far are to TcDeriv; everyting else is a minor consequence. While I was at it, I changed the syntax for standalone deriving, so that it goes derive instance Show (T a) (instead of "derive Show for T"). However, there's still an implicit context, generated by the deriving code, and I wonder if it shouldn't really be derive instance (..) => Show (T a) but I have left it simple for now. I also added a function Type.substTyVars, and used it here and there, which led to some one-line changes otherwise unrelated (sorry). Loose ends: * 'deriving Typeable' for indexed data types is still not right * standalone deriving should be documented
* Adding a GENERATED pragmaandy@galois.com2006-12-291-0/+3
| | | | | | | | Adding a {-# GENERATED "SourceFile" SourceSpan #-} <expr> pragma. This will be used to generate coverage for tool generated (or quoted) code. The pragma states the the expression was generated/quoted from the stated source file and source span.
* fix to isNormalComment for non-Haddock mode, and some cleanupSimon Marlow2006-11-291-12/+11
| | | | | | Haddock documentation comments weren't being treated as comments even without the -haddock flag. Fixes nofib/spectral/simple, and probably others.
* Module header tidyup #2Simon Marlow2006-10-111-3/+3
| | | | Push this further along, and fix build problems in the first patch.
* Merge Haddock comment support from ghc.haddock -- big patchdavve@dtek.chalmers.se2006-10-051-60/+230
|
* New syntax for stand-alone deriving. Implemented fully.bjorn@bringert.net2006-09-181-0/+3
|