Skip to content

Commit

Permalink
Q11
Browse files Browse the repository at this point in the history
  • Loading branch information
susumu2357 committed Jul 18, 2022
1 parent b7c8c78 commit 4f3ccc6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sources/play_library/PlayFParsec/Scratch.fsx
Expand Up @@ -31,4 +31,15 @@ run pColumn2 "  [名前]  "

// カッコの内側のスペースはそのままパース
run pColumn2 "  [名 前]  "
run pColumn2 "  [名前 学年]  "
run pColumn2 "  [名前 学年]  "


// 課題11: projectのパーサーを書こう
let eachColumn = sepBy pColumn2 (pstring ",")
let pProjcet = ws2 >>. (str_ws2 "project") >>. (str_ws2 "(") >>. eachColumn .>> (str_ws2 ")")

run pProjcet "project([場所], [学年])"
run pProjcet "  project (  [場所]  , [学年]  ) "

// 「返す型もちゃんと作りましょう。」というリクエストがよく分からず、特に実装していないです。
// pProjectのreturnは、ParserResult<string list,unit>ですが、Successの場合に新しく定義したProject型で値を返すという感じでしょうか?

0 comments on commit 4f3ccc6

Please sign in to comment.