Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
inox
Commits
32f3a9a0
Commit
32f3a9a0
authored
9 years ago
by
Mikaël Mayer
Browse files
Options
Downloads
Patches
Plain Diff
Moved StrOps to its own file.
Made StrOps available from the library.
parent
233c8969
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
library/lang/StrOps.scala
+42
-0
42 additions, 0 deletions
library/lang/StrOps.scala
library/lang/package.scala
+0
-31
0 additions, 31 deletions
library/lang/package.scala
src/main/scala/leon/utils/Library.scala
+2
-1
2 additions, 1 deletion
src/main/scala/leon/utils/Library.scala
with
44 additions
and
32 deletions
library/lang/StrOps.scala
0 → 100644
+
42
−
0
View file @
32f3a9a0
package
leon.lang
import
leon.annotation._
/**
* @author Mikael
*/
object
StrOps
{
@ignore
def
concat
(
a
:
String
,
b
:
String
)
:
String
=
{
a
+
b
}
@ignore
def
length
(
a
:
String
)
:
BigInt
=
{
BigInt
(
a
.
length
)
}
@ignore
def
substring
(
a
:
String
,
start
:
BigInt
,
end
:
BigInt
)
:
String
=
{
if
(
start
>
end
||
start
>=
length
(
a
)
||
end
<=
0
)
""
else
a
.
substring
(
start
.
toInt
,
end
.
toInt
)
}
@ignore
def
bigIntToString
(
a
:
BigInt
)
:
String
=
{
a
.
toString
}
@ignore
def
intToString
(
a
:
Int
)
:
String
=
{
a
.
toString
}
@ignore
def
doubleToString
(
a
:
Double
)
:
String
=
{
a
.
toString
}
def
booleanToString
(
a
:
Boolean
)
:
String
=
{
if
(
a
)
"true"
else
"false"
}
@ignore
def
charToString
(
a
:
Char
)
:
String
=
{
a
.
toString
}
@ignore
def
realToString
(
a
:
Real
)
:
String
=
???
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
library/lang/package.scala
+
0
−
31
View file @
32f3a9a0
...
...
@@ -67,35 +67,4 @@ package object lang {
}
}
}
@ignore
object
StrOps
{
def
concat
(
a
:
String
,
b
:
String
)
:
String
=
{
a
+
b
}
def
length
(
a
:
String
)
:
BigInt
=
{
BigInt
(
a
.
length
)
}
def
substring
(
a
:
String
,
start
:
BigInt
,
end
:
BigInt
)
:
String
=
{
if
(
start
>
end
||
start
>=
length
(
a
)
||
end
<=
0
)
""
else
a
.
substring
(
start
.
toInt
,
end
.
toInt
)
}
def
bigIntToString
(
a
:
BigInt
)
:
String
=
{
a
.
toString
}
def
intToString
(
a
:
Int
)
:
String
=
{
a
.
toString
}
def
doubleToString
(
a
:
Double
)
:
String
=
{
a
.
toString
}
def
booleanToString
(
a
:
Boolean
)
:
String
=
{
if
(
a
)
"true"
else
"false"
}
def
charToString
(
a
:
Char
)
:
String
=
{
a
.
toString
}
def
realToString
(
a
:
Real
)
:
String
=
???
}
}
This diff is collapsed.
Click to expand it.
src/main/scala/leon/utils/Library.scala
+
2
−
1
View file @
32f3a9a0
...
...
@@ -16,7 +16,8 @@ case class Library(pgm: Program) {
lazy
val
Some
=
lookup
(
"leon.lang.Some"
).
collectFirst
{
case
ccd
:
CaseClassDef
=>
ccd
}
lazy
val
None
=
lookup
(
"leon.lang.None"
).
collectFirst
{
case
ccd
:
CaseClassDef
=>
ccd
}
lazy
val
String
=
lookup
(
"leon.lang.string.String"
).
collectFirst
{
case
ccd
:
CaseClassDef
=>
ccd
}
//lazy val String = lookup("leon.lang.string.String").collectFirst { case ccd : CaseClassDef => ccd }
lazy
val
StrOps
=
lookup
(
"leon.lang.StrOps"
).
collectFirst
{
case
md
:
ModuleDef
=>
md
}
lazy
val
Dummy
=
lookup
(
"leon.lang.Dummy"
).
collectFirst
{
case
ccd
:
CaseClassDef
=>
ccd
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment