Merge pull request #1177 from pete-ts/feature/1160

fix/1160
This commit is contained in:
mergify[bot] 2020-01-28 20:10:48 +00:00 committed by GitHub
commit 84e6446f31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 115 additions and 3 deletions

View File

@ -302,7 +302,7 @@ ucmCommand = do
fenced :: P Stanza
fenced = do
fence
fenceType <- lineToken (word "ucm" <|> word "unison" <|> lineUntilSpace)
fenceType <- lineToken(word "ucm" <|> word "unison" <|> language)
stanza <-
if fenceType == "ucm" then do
hide <- hidden
@ -381,8 +381,8 @@ expectingError = isJust <$> optional (word ":error")
untilSpace1 :: P Text
untilSpace1 = P.takeWhile1P Nothing (not . Char.isSpace)
lineUntilSpace :: P Text
lineUntilSpace = P.takeWhileP Nothing (\ch -> ch `elem` (" \t" :: String))
language :: P Text
language = P.takeWhileP Nothing (\ch -> Char.isDigit ch || Char.isLower ch || ch == '_' )
spaces :: P ()
spaces = void $ P.takeWhileP (Just "spaces") Char.isSpace

View File

@ -0,0 +1,37 @@
### Transcript parser operations
The transcript parser is meant to parse `ucm` and `unison` blocks.
```unison
x = 1
```
```ucm
.> add
```
```unison:hide:error:scratch.u
z
```
```ucm:error
.> delete foo
```
```ucm :error
.> delete lineToken.call
```
However handling of blocks of other languages should be supported.
```python
some python code
```
```c_cpp
some C++ code
```
```c9search
some cloud9 code
```

View File

@ -0,0 +1,75 @@
### Transcript parser operations
The transcript parser is meant to parse `ucm` and `unison` blocks.
```unison
x = 1
```
```ucm
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These new definitions are ok to `add`:
x : Nat
Now evaluating any watch expressions (lines starting with
`>`)... Ctrl+C cancels.
```
```ucm
.> add
⍟ I've added these definitions:
x : Nat
```
```unison
---
title: :scratch.u
---
z
```
```ucm
.> delete foo
⚠️
I don't know about that name.
```
```ucm
.> delete lineToken.call
⚠️
I don't know about that name.
```
However handling of blocks of other languages should be supported.
```python
some python code
```
```c_cpp
some C++ code
```
```c9search
some cloud9 code
```