-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
21 changed files
with
269 additions
and
103 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,48 @@ | ||
import { ReactElement, ReactFragment } from 'react'; | ||
import { PpString } from '../types'; | ||
|
||
export const fragmentOfPpString = (pp:PpString, classes:CSSModuleClasses) : ReactFragment => { | ||
enum PpMode { vertical, horizontal } | ||
|
||
const fragmentOfPpStringWithMode = (pp:PpString, mode: PpMode, 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)); | ||
return pp[1].map(pp => fragmentOfPpStringWithMode(pp, mode, classes)); | ||
case "Ppcmd_box": | ||
return fragmentOfPpString(pp[2], classes); | ||
switch (pp[1][0]) { | ||
case "Pp_hbox": | ||
mode = PpMode.horizontal; | ||
break; | ||
case "Pp_vbox": | ||
mode = PpMode.vertical; | ||
break; | ||
case "Pp_hvbox": | ||
mode = PpMode.horizontal; // TODO proper support for hvbox | ||
break; | ||
case "Pp_hovbox": | ||
mode = PpMode.horizontal; // TODO proper support for hovbox | ||
break; | ||
}; | ||
return fragmentOfPpStringWithMode(pp[2], mode, classes); | ||
case "Ppcmd_tag": | ||
return <span className={classes[pp[1].replace(".", "-")]}>{fragmentOfPpString(pp[2], classes)}</span>; | ||
return <span className={classes[pp[1].replaceAll(".", "-")]}>{fragmentOfPpStringWithMode(pp[2], mode, classes)}</span>; | ||
case "Ppcmd_print_break": | ||
return " ".repeat(pp[1]); | ||
switch (mode) { | ||
case PpMode.horizontal: | ||
return " ".repeat(pp[1]); | ||
case PpMode.vertical: | ||
return <br/>; | ||
} | ||
case "Ppcmd_force_newline": | ||
return <br/>; | ||
case "Ppcmd_comment": | ||
return pp[1]; | ||
} | ||
}; | ||
|
||
export const fragmentOfPpString = (pp:PpString, classes:CSSModuleClasses) : ReactFragment => { | ||
return fragmentOfPpStringWithMode(pp, PpMode.horizontal, classes); | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
Definition foo := True. | ||
|
||
Definition bar := zar. | ||
Lemma foo : True -> True -> True. | ||
Proof. | ||
intros H1. intros H2. intros H3. | ||
Qed. |
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
Oops, something went wrong.