-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #559 from coq-community/goal-pp
Syntax highlighting in proofview
- Loading branch information
Showing
14 changed files
with
246 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ReactElement, ReactFragment } from 'react'; | ||
import { PpString } from '../types'; | ||
|
||
export const fragmentOfPpString = (pp:PpString, classes:CSSModuleClasses) : ReactFragment => { | ||
switch (pp[0]) { | ||
case "Ppcmd_empty": | ||
return <></>; | ||
case "Ppcmd_string": | ||
return pp[1]; | ||
case "Ppcmd_glue": | ||
return pp[1].map(pp => fragmentOfPpString(pp, classes)); | ||
case "Ppcmd_box": | ||
return fragmentOfPpString(pp[2], classes); | ||
case "Ppcmd_tag": | ||
return <span className={classes[pp[1].replace(".", "-")]}>{fragmentOfPpString(pp[2], classes)}</span>; | ||
case "Ppcmd_print_break": | ||
return " ".repeat(pp[1]); | ||
case "Ppcmd_force_newline": | ||
return <br/>; | ||
case "Ppcmd_comment": | ||
return pp[1]; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(**************************************************************************) | ||
(* *) | ||
(* VSCoq *) | ||
(* *) | ||
(* Copyright INRIA and contributors *) | ||
(* (see version control and README file for authors & dates) *) | ||
(* *) | ||
(**************************************************************************) | ||
(* *) | ||
(* This file is distributed under the terms of the MIT License. *) | ||
(* See LICENSE file. *) | ||
(* *) | ||
(**************************************************************************) | ||
|
||
type pp_tag = string [@@deriving yojson] | ||
|
||
type block_type = Pp.block_type = | ||
| Pp_hbox | ||
| Pp_vbox of int | ||
| Pp_hvbox of int | ||
| Pp_hovbox of int | ||
[@@deriving yojson] | ||
|
||
type pp = | ||
| Ppcmd_empty | ||
| Ppcmd_string of string | ||
| Ppcmd_glue of pp list | ||
| Ppcmd_box of block_type * pp | ||
| Ppcmd_tag of pp_tag * pp | ||
| Ppcmd_print_break of int * int | ||
| Ppcmd_force_newline | ||
| Ppcmd_comment of string list | ||
[@@deriving yojson] | ||
|
||
let rec pp_of_coqpp t = match Pp.repr t with | ||
| Pp.Ppcmd_empty -> Ppcmd_empty | ||
| Pp.Ppcmd_string s -> Ppcmd_string s | ||
| Pp.Ppcmd_glue l -> Ppcmd_glue (List.map pp_of_coqpp l) | ||
| Pp.Ppcmd_box (bt, pp) -> Ppcmd_box (bt, pp_of_coqpp pp) | ||
| Pp.Ppcmd_tag (tag, pp) -> Ppcmd_tag (tag, pp_of_coqpp pp) | ||
| Pp.Ppcmd_print_break (m,n) -> Ppcmd_print_break (m,n) | ||
| Pp.Ppcmd_force_newline -> Ppcmd_force_newline | ||
| Pp.Ppcmd_comment l -> Ppcmd_comment l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(**************************************************************************) | ||
(* *) | ||
(* VSCoq *) | ||
(* *) | ||
(* Copyright INRIA and contributors *) | ||
(* (see version control and README file for authors & dates) *) | ||
(* *) | ||
(**************************************************************************) | ||
(* *) | ||
(* This file is distributed under the terms of the MIT License. *) | ||
(* See LICENSE file. *) | ||
(* *) | ||
(**************************************************************************) | ||
|
||
type pp [@@deriving yojson] | ||
|
||
val pp_of_coqpp : Pp.t -> pp |
Oops, something went wrong.