Skip to content

Commit

Permalink
Move automaton table
Browse files Browse the repository at this point in the history
  • Loading branch information
baioc committed Nov 24, 2021
1 parent 89ba99c commit 2941b2f
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions src/Client/Index.fs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ let update (msg: Msg) (model: Model) : Model * Cmd<Msg> =
|> SweetAlert.Run


let projectSyntactical (grammar: Grammar) analysisTable lexSpec lexer (head: string, body: string) dispatch =
let projectSyntactical (grammar: Grammar) lexSpec lexer (head: string, body: string) dispatch =
let viewProductionRule (head, body) =
Bulma.columns [
columns.isVCentered
Expand Down Expand Up @@ -633,17 +633,10 @@ let projectSyntactical (grammar: Grammar) analysisTable lexSpec lexer (head: str
column.isFull
prop.children [ viewSpec ]
]
match analysisTable with
| None -> ()
| Some table ->
Bulma.column [
column.isFull
prop.children [ table ]
]
]
]

let projectLexical spec analysisTable (kind, name, body) dispatch =
let projectLexical spec (kind, name, body) dispatch =
// kinds of regular definitions
let tokenOption = "token"
let fragmentOption = "fragment"
Expand Down Expand Up @@ -958,13 +951,6 @@ let projectLexical spec analysisTable (kind, name, body) dispatch =
column.isFull
prop.children [ viewSpec ]
]
match analysisTable with
| None -> ()
| Some table ->
Bulma.column [
column.isFull
prop.children [ table ]
]
]
]

Expand Down Expand Up @@ -1095,17 +1081,15 @@ let main model dispatch =
Bulma.cardContent [
projectLexical
model.Project.Lexicon
model.LexicalAnalysisTable
model.RegularDefinitionText
dispatch ]
]
| Syntactical ->
Bulma.card [
Bulma.cardHeader [ cardTitle "LL(1) Grammar" ]
Bulma.cardHeader [ cardTitle "LL(1) BNF Grammar" ]
Bulma.cardContent [
projectSyntactical
model.Project.Syntax
model.SyntacticalAnalysisTable
model.Project.Lexicon
model.Lexer
model.GrammarProductionText
Expand All @@ -1126,6 +1110,22 @@ let main model dispatch =
]
]

let tableInterface =
Bulma.card [
Bulma.cardHeader [ cardTitle "Automaton" ]
Bulma.cardContent [
match model.Phase with
| Lexical ->
match model.LexicalAnalysisTable with
| None -> ()
| Some table -> table
| Syntactical ->
match model.SyntacticalAnalysisTable with
| None -> ()
| Some table -> table
]
]

Bulma.columns [
columns.isMultiline
columns.isCentered
Expand All @@ -1140,6 +1140,10 @@ let main model dispatch =
column.isHalfWidescreen
prop.children [ recognitionInterface ]
]
Bulma.column [
column.isFull
prop.children [ tableInterface ]
]
]
]

Expand Down

0 comments on commit 2941b2f

Please sign in to comment.