Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added __FILELINE__ and it's test file #3597

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

briangmilnes
Copy link
Contributor

No description provided.

@briangmilnes
Copy link
Contributor Author

Guido can you put this in so I can put out Flog and Final please?

@mtzguido
Copy link
Member

mtzguido commented Nov 8, 2024

Hi Brian, can you do the changes we talked about here #3574 (comment). It should return only the basename of the file (no leading directory components) and then the test would work without anything fancy (string_of_list, etc)

@briangmilnes
Copy link
Contributor Author

All good, rebuild and retested just to be sure.
But it still needs the list_of_string/string_of_list.
Good enough?

@briangmilnes
Copy link
Contributor Author

I tried to move the string code changes into FStarC_Parser_LexFStar with
| "FILELINE" -> STRING (
let fl = ((L.source_file lexbuf) ^ "(" ^ (string_of_int (L.current_line lexbuf)) ^ ")") in
let lfl = BatList.init (BatUTF8.length fl) (fun i -> BatUChar.code (BatUTF8.get fl i)) in
let sfl = BatUTF8.init (BatList.length lfl) (fun i -> BatUChar.chr (BatList.at lfl i)) in
sfl)

but when I

let fl1 = FILELINE in
print_string("|" ^ FILELINE ^ "|" ^ (strlen fl1) ^ "\n");

strlen says F* is typing fl1 as a nat.

Any idea how a STRING () lexeme can end up gettting typed as a nat?

@briangmilnes
Copy link
Contributor Author

Yet print as a string directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants