Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
L ldpl
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 8
    • Issues 8
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Lartu
  • ldpl
  • Merge requests
  • !46

Merged
Created Apr 13, 2019 by Lartu@lartu🐕Maintainer

Convert invalid chars to numbers, not letters

  • Overview 2
  • Commits 1
  • Changes 1

Created by: dvkt

The way fix_identifier encodes invalid characters is causing some collisions, I think because it's only using the alphabet.

For example, - and _ both become r_U.

This patch changes it so the raw character number is used instead. The mangled names are nastier, but there won't be collisions.

The reason I didn't just "fix" this in master is I'm wondering if you had any other ideas for how to solve for the collisions?

Currently:

one-two => VAR_ONEr_UTWO
one_two => VAR_ONEr_UTWO
one😎two => VAR_ONEr_Fr_Yr_Rr_HTWO

With this patch:

one-two => VAR_ONEc45_TWO
one_two => VAR_ONEc95_TWO
one😎two => VAR_ONEc4294967280_c4294967199_c4294967192_c4294967182_TWO

Here's a working example:

$ cat bug.lsc
DATA:
one-two is text
one_two is text

PROCEDURE:
store "okay" in one-two 
store "not okay" in one_two 

display "- " one-two crlf
display "_ " one-two crlf⏎
$ ldpl bug.lsc 
LDPL: Compiling...
ldpl-temp.cpp:232:8: error: redefinition of 'VAR_ONEr_UTWO'
string VAR_ONEr_UTWO = "";
       ^
ldpl-temp.cpp:231:8: note: previous definition is here
string VAR_ONEr_UTWO = "";
       ^
1 error generated.
LDPL Error: compilation failed.

Then, with this patch:

$ ldpl bug.lsc
LDPL: Compiling...
* File(s) compiled successfully.
* Saved as bug-bin
$  ./bug-bin
- okay
_ okay
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: github/fork/dvkt/num-conversion